diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2d332ff7..38fd1768 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: toolchain: - { name: 'MSVC', shell: 'sh', setup-cmake: true, setup-ninja: true, setup-msvc: true } # TODO: Add back eventually, but exclude 3rdparty code from warnings as errors - # - { name: 'msys2 mingw32', shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, clang-tidy: true, werror: true } + - { name: 'msys2 mingw32', shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, clang-tidy: true, werror: true, no-dx5-libs: true } # - { name: 'msys2 clang32', shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686, clang-tidy: true, werror: true, no-dx5-libs: true } steps: diff --git a/.github/workflows/naming.yml b/.github/workflows/naming.yml index 3afed885..20ffddff 100644 --- a/.github/workflows/naming.yml +++ b/.github/workflows/naming.yml @@ -29,7 +29,7 @@ jobs: --recurse \ --style tools/ncc/ncc.style \ --skip tools/ncc/skip.yml \ - --definition WINAPI FAR BOOL CALLBACK HWND__=HWND \ + --definition WINAPI FAR BOOL CALLBACK HWND__=HWND SDLCALL \ --include \ util \ LEGO1 \ diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt new file mode 100644 index 00000000..f862cf56 --- /dev/null +++ b/3rdparty/CMakeLists.txt @@ -0,0 +1,26 @@ +set(CMAKE_C_CLANG_TIDY) + +add_library(miniaudio STATIC + miniaudio/extras/miniaudio_split/miniaudio.c +) +target_include_directories(miniaudio PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/miniaudio/extras/miniaudio_split") +set_property(TARGET miniaudio PROPERTY ARCHIVE_OUTPUT_NAME "miniaudio$<$:d>") +# Disable most features since we don't need them. +target_compile_definitions(miniaudio PUBLIC + MA_ENABLE_ONLY_SPECIFIC_BACKENDS + MA_NO_DECODING + MA_NO_ENCODING + MA_NO_WAV + MA_NO_FLAC + MA_NO_MP3 + MA_NO_DEVICE_IO + MA_NO_RESOURCE_MANAGER + MA_NO_GENERATION + MA_NO_THREADING +) + +add_library(libsmacker STATIC + libsmacker/smacker.c +) +set_property(TARGET libsmacker PROPERTY ARCHIVE_OUTPUT_NAME "libsmacker$<$:d>") +target_include_directories(libsmacker PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/libsmacker") diff --git a/3rdparty/d3drm/CMakeLists.txt b/3rdparty/d3drm/CMakeLists.txt new file mode 100644 index 00000000..76cf1be3 --- /dev/null +++ b/3rdparty/d3drm/CMakeLists.txt @@ -0,0 +1,30 @@ +project(wine_d3drm LANGUAGES C) + +set(CMAKE_C_CLANG_TIDY) + +add_library(d3drm-wine SHARED EXCLUDE_FROM_ALL + d3drm.c + d3drm_main.c + d3drm_private.h + d3drm.spec + device.c + face.c + frame.c + light.c + material.c + math.c + meshbuilder.c + texture.c + version.rc + viewport.c + + d3drm.def +) +target_include_directories(d3drm-wine SYSTEM INTERFACE "${CMAKE_CURRENT_LIST_DIR}/include") +target_link_libraries(d3drm-wine PRIVATE d3dxof ddraw) +set_property(TARGET d3drm-wine PROPERTY PREFIX "") +set_property(TARGET d3drm-wine PROPERTY OUTPUT_NAME "d3drm") +target_compile_definitions(d3drm-wine PRIVATE "__WINESRC__") +target_compile_definitions(d3drm-wine PRIVATE "WINE_NO_TRACE_MSGS") +target_compile_definitions(d3drm-wine PRIVATE "WINE_NO_DEBUG_MSGS") +target_compile_definitions(d3drm-wine PRIVATE "DECLSPEC_EXPORT=") diff --git a/3rdparty/d3drm/COPYING.LIB b/3rdparty/d3drm/COPYING.LIB new file mode 100644 index 00000000..732811e4 --- /dev/null +++ b/3rdparty/d3drm/COPYING.LIB @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/3rdparty/d3drm/Makefile.in b/3rdparty/d3drm/Makefile.in new file mode 100644 index 00000000..e5381b49 --- /dev/null +++ b/3rdparty/d3drm/Makefile.in @@ -0,0 +1,19 @@ +MODULE = d3drm.dll +IMPORTLIB = d3drm +IMPORTS = d3dxof ddraw + +EXTRADLLFLAGS = -Wb,--prefer-native + +SOURCES = \ + d3drm.c \ + d3drm_main.c \ + device.c \ + face.c \ + frame.c \ + light.c \ + material.c \ + math.c \ + meshbuilder.c \ + texture.c \ + version.rc \ + viewport.c diff --git a/3rdparty/d3drm/d3drm.c b/3rdparty/d3drm/d3drm.c new file mode 100644 index 00000000..393016a4 --- /dev/null +++ b/3rdparty/d3drm/d3drm.c @@ -0,0 +1,2350 @@ +/* + * Implementation of IDirect3DRM Interface + * + * Copyright 2010, 2012 Christian Costa + * Copyright 2011 André Hentschel + * Copyright 2016 Aaryaman Vasishta + * + * 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 + */ + +#include "d3drm_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d3drm); + +static const char* get_IID_string(const GUID* guid) +{ + if (IsEqualGUID(guid, &IID_IDirect3DRMFrame)) + return "IID_IDirect3DRMFrame"; + else if (IsEqualGUID(guid, &IID_IDirect3DRMFrame2)) + return "IID_IDirect3DRMFrame2"; + else if (IsEqualGUID(guid, &IID_IDirect3DRMFrame3)) + return "IID_IDirect3DRMFrame3"; + else if (IsEqualGUID(guid, &IID_IDirect3DRMMeshBuilder)) + return "IID_IDirect3DRMMeshBuilder"; + else if (IsEqualGUID(guid, &IID_IDirect3DRMMeshBuilder2)) + return "IID_IDirect3DRMMeshBuilder2"; + else if (IsEqualGUID(guid, &IID_IDirect3DRMMeshBuilder3)) + return "IID_IDirect3DRMMeshBuilder3"; + + return "?"; +} + +static HRESULT d3drm_create_texture_object(void **object, IDirect3DRM *d3drm) +{ + struct d3drm_texture *texture; + HRESULT hr; + + if (FAILED(hr = d3drm_texture_create(&texture, d3drm))) + return hr; + + *object = &texture->IDirect3DRMTexture_iface; + + return hr; +} + +static HRESULT d3drm_create_device_object(void **object, IDirect3DRM *d3drm) +{ + struct d3drm_device *device; + HRESULT hr; + + if (FAILED(hr = d3drm_device_create(&device, d3drm))) + return hr; + + *object = &device->IDirect3DRMDevice_iface; + + return hr; +} + +static HRESULT d3drm_create_viewport_object(void **object, IDirect3DRM *d3drm) +{ + struct d3drm_viewport *viewport; + HRESULT hr; + + if (FAILED(hr = d3drm_viewport_create(&viewport, d3drm))) + return hr; + + *object = &viewport->IDirect3DRMViewport_iface; + + return hr; +} + +static HRESULT d3drm_create_face_object(void **object, IDirect3DRM *d3drm) +{ + struct d3drm_face *face; + HRESULT hr; + + if (FAILED(hr = d3drm_face_create(&face))) + return hr; + + *object = &face->IDirect3DRMFace_iface; + + return hr; +} + +static HRESULT d3drm_create_mesh_builder_object(void **object, IDirect3DRM *d3drm) +{ + struct d3drm_mesh_builder *mesh_builder; + HRESULT hr; + + if (FAILED(hr = d3drm_mesh_builder_create(&mesh_builder, d3drm))) + return hr; + + *object = &mesh_builder->IDirect3DRMMeshBuilder2_iface; + + return hr; +} + +static HRESULT d3drm_create_frame_object(void **object, IDirect3DRM *d3drm) +{ + struct d3drm_frame *frame; + HRESULT hr; + + if (FAILED(hr = d3drm_frame_create(&frame, NULL, d3drm))) + return hr; + + *object = &frame->IDirect3DRMFrame_iface; + + return hr; +} + +static HRESULT d3drm_create_light_object(void **object, IDirect3DRM *d3drm) +{ + struct d3drm_light *light; + HRESULT hr; + + if (FAILED(hr = d3drm_light_create(&light, d3drm))) + return hr; + + *object = &light->IDirect3DRMLight_iface; + + return hr; +} + +static HRESULT d3drm_create_material_object(void **object, IDirect3DRM *d3drm) +{ + struct d3drm_material *material; + HRESULT hr; + + if (FAILED(hr = d3drm_material_create(&material, d3drm))) + return hr; + + *object = &material->IDirect3DRMMaterial2_iface; + + return hr; +} + +static HRESULT d3drm_create_mesh_object(void **object, IDirect3DRM *d3drm) +{ + struct d3drm_mesh *mesh; + HRESULT hr; + + if (FAILED(hr = d3drm_mesh_create(&mesh, d3drm))) + return hr; + + *object = &mesh->IDirect3DRMMesh_iface; + + return hr; +} + +static HRESULT d3drm_create_animation_object(void **object, IDirect3DRM *d3drm) +{ + struct d3drm_animation *animation; + HRESULT hr; + + if (FAILED(hr = d3drm_animation_create(&animation, d3drm))) + return hr; + + *object = &animation->IDirect3DRMAnimation_iface; + + return hr; +} + +static HRESULT d3drm_create_wrap_object(void **object, IDirect3DRM *d3drm) +{ + struct d3drm_wrap *wrap; + HRESULT hr; + + if (FAILED(hr = d3drm_wrap_create(&wrap, d3drm))) + return hr; + + *object = &wrap->IDirect3DRMWrap_iface; + + return hr; +} + +struct d3drm +{ + IDirect3DRM IDirect3DRM_iface; + IDirect3DRM2 IDirect3DRM2_iface; + IDirect3DRM3 IDirect3DRM3_iface; + LONG ref1, ref2, ref3, iface_count; +}; + +static inline struct d3drm *impl_from_IDirect3DRM(IDirect3DRM *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm, IDirect3DRM_iface); +} + +static inline struct d3drm *impl_from_IDirect3DRM2(IDirect3DRM2 *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm, IDirect3DRM2_iface); +} + +static inline struct d3drm *impl_from_IDirect3DRM3(IDirect3DRM3 *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm, IDirect3DRM3_iface); +} + +static void d3drm_destroy(struct d3drm *d3drm) +{ + TRACE("d3drm object %p is being destroyed.\n", d3drm); + free(d3drm); +} + +static HRESULT WINAPI d3drm1_QueryInterface(IDirect3DRM *iface, REFIID riid, void **out) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRM) + || IsEqualGUID(riid, &IID_IUnknown)) + { + *out = &d3drm->IDirect3DRM_iface; + } + else if (IsEqualGUID(riid, &IID_IDirect3DRM2)) + { + *out = &d3drm->IDirect3DRM2_iface; + } + else if (IsEqualGUID(riid, &IID_IDirect3DRM3)) + { + *out = &d3drm->IDirect3DRM3_iface; + } + else + { + *out = NULL; + WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid)); + return CLASS_E_CLASSNOTAVAILABLE; + } + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} + +static ULONG WINAPI d3drm1_AddRef(IDirect3DRM *iface) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM(iface); + ULONG refcount = InterlockedIncrement(&d3drm->ref1); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + if (refcount == 1) + InterlockedIncrement(&d3drm->iface_count); + + return refcount; +} + +static ULONG WINAPI d3drm1_Release(IDirect3DRM *iface) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM(iface); + ULONG refcount = InterlockedDecrement(&d3drm->ref1); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount && !InterlockedDecrement(&d3drm->iface_count)) + d3drm_destroy(d3drm); + + return refcount; +} + +static HRESULT WINAPI d3drm1_CreateObject(IDirect3DRM *iface, + REFCLSID clsid, IUnknown *outer, REFIID iid, void **out) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM(iface); + + TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n", + iface, debugstr_guid(clsid), outer, debugstr_guid(iid), out); + + return IDirect3DRM3_CreateObject(&d3drm->IDirect3DRM3_iface, clsid, outer, iid, out); +} + +static HRESULT WINAPI d3drm1_CreateFrame(IDirect3DRM *iface, + IDirect3DRMFrame *parent_frame, IDirect3DRMFrame **frame) +{ + struct d3drm_frame *object; + HRESULT hr; + + TRACE("iface %p, parent_frame %p, frame %p.\n", iface, parent_frame, frame); + + if (FAILED(hr = d3drm_frame_create(&object, (IUnknown *)parent_frame, iface))) + return hr; + + *frame = &object->IDirect3DRMFrame_iface; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm1_CreateMesh(IDirect3DRM *iface, IDirect3DRMMesh **mesh) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM(iface); + + TRACE("iface %p, mesh %p.\n", iface, mesh); + + return IDirect3DRM3_CreateMesh(&d3drm->IDirect3DRM3_iface, mesh); +} + +static HRESULT WINAPI d3drm1_CreateMeshBuilder(IDirect3DRM *iface, IDirect3DRMMeshBuilder **mesh_builder) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM(iface); + + TRACE("iface %p, mesh_builder %p.\n", iface, mesh_builder); + + return IDirect3DRM2_CreateMeshBuilder(&d3drm->IDirect3DRM2_iface, (IDirect3DRMMeshBuilder2 **)mesh_builder); +} + +static HRESULT WINAPI d3drm1_CreateFace(IDirect3DRM *iface, IDirect3DRMFace **face) +{ + struct d3drm_face *object; + HRESULT hr; + + TRACE("iface %p, face %p.\n", iface, face); + + if (FAILED(hr = d3drm_face_create(&object))) + return hr; + + *face = &object->IDirect3DRMFace_iface; + + return S_OK; +} + +static HRESULT WINAPI d3drm1_CreateAnimation(IDirect3DRM *iface, IDirect3DRMAnimation **animation) +{ + struct d3drm_animation *object; + HRESULT hr; + + TRACE("iface %p, animation %p.\n", iface, animation); + + if (!animation) + return D3DRMERR_BADVALUE; + + if (FAILED(hr = d3drm_animation_create(&object, iface))) + return hr; + + *animation = &object->IDirect3DRMAnimation_iface; + + return S_OK; +} + +static HRESULT WINAPI d3drm1_CreateAnimationSet(IDirect3DRM *iface, IDirect3DRMAnimationSet **set) +{ + FIXME("iface %p, set %p stub!\n", iface, set); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm1_CreateTexture(IDirect3DRM *iface, + D3DRMIMAGE *image, IDirect3DRMTexture **texture) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM(iface); + IDirect3DRMTexture3 *texture3; + HRESULT hr; + + TRACE("iface %p, image %p, texture %p.\n", iface, image, texture); + + if (!texture) + return D3DRMERR_BADVALUE; + + if (FAILED(hr = IDirect3DRM3_CreateTexture(&d3drm->IDirect3DRM3_iface, image, &texture3))) + { + *texture = NULL; + return hr; + } + + hr = IDirect3DRMTexture3_QueryInterface(texture3, &IID_IDirect3DRMTexture, (void **)texture); + IDirect3DRMTexture3_Release(texture3); + + return hr; +} + +static HRESULT WINAPI d3drm1_CreateLight(IDirect3DRM *iface, + D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM(iface); + + TRACE("iface %p, type %#x, color 0x%08lx, light %p.\n", iface, type, color, light); + + return IDirect3DRM3_CreateLight(&d3drm->IDirect3DRM3_iface, type, color, light); +} + +static HRESULT WINAPI d3drm1_CreateLightRGB(IDirect3DRM *iface, D3DRMLIGHTTYPE type, + D3DVALUE red, D3DVALUE green, D3DVALUE blue, IDirect3DRMLight **light) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM(iface); + + TRACE("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p.\n", + iface, type, red, green, blue, light); + + return IDirect3DRM3_CreateLightRGB(&d3drm->IDirect3DRM3_iface, type, red, green, blue, light); +} + +static HRESULT WINAPI d3drm1_CreateMaterial(IDirect3DRM *iface, + D3DVALUE power, IDirect3DRMMaterial **material) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM(iface); + + TRACE("iface %p, power %.8e, material %p.\n", iface, power, material); + + return IDirect3DRM3_CreateMaterial(&d3drm->IDirect3DRM3_iface, power, (IDirect3DRMMaterial2 **)material); +} + +static HRESULT WINAPI d3drm1_CreateDevice(IDirect3DRM *iface, + DWORD width, DWORD height, IDirect3DRMDevice **device) +{ + TRACE("iface %p, width %lu, height %lu, device %p.\n", iface, width, height, device); + + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + + return D3DRMERR_BADDEVICE; +} + +static HRESULT WINAPI d3drm1_CreateDeviceFromSurface(IDirect3DRM *iface, GUID *guid, + IDirectDraw *ddraw, IDirectDrawSurface *backbuffer, IDirect3DRMDevice **device) +{ + struct d3drm_device *object; + HRESULT hr; + + TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, device %p.\n", + iface, debugstr_guid(guid), ddraw, backbuffer, device); + + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + + if (!backbuffer || !ddraw) + return D3DRMERR_BADDEVICE; + + if (FAILED(hr = d3drm_device_create(&object, iface))) + return hr; + + if (SUCCEEDED(hr = d3drm_device_init(object, 1, ddraw, backbuffer, TRUE))) + *device = &object->IDirect3DRMDevice_iface; + else + d3drm_device_destroy(object); + + return hr; +} + +static HRESULT WINAPI d3drm1_CreateDeviceFromD3D(IDirect3DRM *iface, + IDirect3D *d3d, IDirect3DDevice *d3d_device, IDirect3DRMDevice **device) +{ + struct d3drm_device *object; + HRESULT hr; + TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n", + iface, d3d, d3d_device, device); + + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + + if (FAILED(hr = d3drm_device_create(&object, iface))) + return hr; + + if (FAILED(hr = IDirect3DRMDevice_InitFromD3D(&object->IDirect3DRMDevice_iface, d3d, d3d_device))) + { + d3drm_device_destroy(object); + return hr; + } + *device = &object->IDirect3DRMDevice_iface; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm1_CreateDeviceFromClipper(IDirect3DRM *iface, + IDirectDrawClipper *clipper, GUID *guid, int width, int height, + IDirect3DRMDevice **device) +{ + struct d3drm_device *object; + IDirectDraw *ddraw; + IDirectDrawSurface *render_target; + HRESULT hr; + + TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n", + iface, clipper, debugstr_guid(guid), width, height, device); + + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + + if (!clipper || !width || !height) + return D3DRMERR_BADVALUE; + + hr = DirectDrawCreate(NULL, &ddraw, NULL); + if (FAILED(hr)) + return hr; + + if (FAILED(hr = d3drm_device_create(&object, iface))) + { + IDirectDraw_Release(ddraw); + return hr; + } + + hr = d3drm_device_create_surfaces_from_clipper(object, ddraw, clipper, width, height, &render_target); + if (FAILED(hr)) + { + IDirectDraw_Release(ddraw); + d3drm_device_destroy(object); + return hr; + } + + hr = d3drm_device_init(object, 1, ddraw, render_target, TRUE); + IDirectDraw_Release(ddraw); + IDirectDrawSurface_Release(render_target); + if (FAILED(hr)) + d3drm_device_destroy(object); + else + *device = &object->IDirect3DRMDevice_iface; + + return hr; +} + +static HRESULT WINAPI d3drm1_CreateTextureFromSurface(IDirect3DRM *iface, + IDirectDrawSurface *surface, IDirect3DRMTexture **texture) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM(iface); + IDirect3DRMTexture3 *texture3; + HRESULT hr; + + TRACE("iface %p, surface %p, texture %p.\n", iface, surface, texture); + + if (!texture) + return D3DRMERR_BADVALUE; + + if (FAILED(hr = IDirect3DRM3_CreateTextureFromSurface(&d3drm->IDirect3DRM3_iface, surface, &texture3))) + { + *texture = NULL; + return hr; + } + + hr = IDirect3DRMTexture3_QueryInterface(texture3, &IID_IDirect3DRMTexture, (void **)texture); + IDirect3DRMTexture3_Release(texture3); + + return hr; +} + +static HRESULT WINAPI d3drm1_CreateShadow(IDirect3DRM *iface, IDirect3DRMVisual *visual, + IDirect3DRMLight *light, D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, + IDirect3DRMVisual **shadow) +{ + FIXME("iface %p, visual %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n", + iface, visual, light, px, py, pz, nx, ny, nz, shadow); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm1_CreateViewport(IDirect3DRM *iface, IDirect3DRMDevice *device, + IDirect3DRMFrame *camera, DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport **viewport) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM(iface); + IDirect3DRMDevice3 *device3; + IDirect3DRMFrame3 *camera3; + IDirect3DRMViewport2 *viewport2; + HRESULT hr; + + TRACE("iface %p, device %p, camera %p, x %lu, y %lu, width %lu, height %lu, viewport %p.\n", + iface, device, camera, x, y, width, height, viewport); + + if (!viewport) + return D3DRMERR_BADVALUE; + *viewport = NULL; + + if (!device || !camera) + return D3DRMERR_BADOBJECT; + + if (FAILED(hr = IDirect3DRMDevice_QueryInterface(device, &IID_IDirect3DRMDevice3, (void **)&device3))) + return hr; + + if (FAILED(hr = IDirect3DRMFrame_QueryInterface(camera, &IID_IDirect3DRMFrame3, (void **)&camera3))) + { + IDirect3DRMDevice3_Release(device3); + return hr; + } + + hr = IDirect3DRM3_CreateViewport(&d3drm->IDirect3DRM3_iface, device3, camera3, x, y, width, height, &viewport2); + IDirect3DRMDevice3_Release(device3); + IDirect3DRMFrame3_Release(camera3); + if (FAILED(hr)) + return hr; + + hr = IDirect3DRMViewport2_QueryInterface(viewport2, &IID_IDirect3DRMViewport, (void **)viewport); + IDirect3DRMViewport2_Release(viewport2); + + return hr; +} + +static HRESULT WINAPI d3drm1_CreateWrap(IDirect3DRM *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame *frame, + D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, D3DVALUE ou, D3DVALUE ov, D3DVALUE su, D3DVALUE sv, + IDirect3DRMWrap **wrap) +{ + struct d3drm_wrap *object; + HRESULT hr; + + FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, " + "ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p, semi-stub.\n", + iface, type, frame, ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv, wrap); + + if (!wrap) + return D3DRMERR_BADVALUE; + + if (FAILED(hr = d3drm_wrap_create(&object, iface))) + return hr; + + *wrap = &object->IDirect3DRMWrap_iface; + + return S_OK; +} + +static HRESULT WINAPI d3drm1_CreateUserVisual(IDirect3DRM *iface, + D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual) +{ + FIXME("iface %p, cb %p, ctx %p visual %p stub!\n", iface, cb, ctx, visual); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm1_LoadTexture(IDirect3DRM *iface, + const char *filename, IDirect3DRMTexture **texture) +{ + struct d3drm_texture *object; + HRESULT hr; + + TRACE("iface %p, filename %s, texture %p.\n", iface, debugstr_a(filename), texture); + + if (!texture) + return D3DRMERR_BADVALUE; + + if (FAILED(hr = d3drm_texture_create(&object, iface))) + return hr; + + *texture = &object->IDirect3DRMTexture_iface; + if (FAILED(hr = IDirect3DRMTexture_InitFromFile(*texture, filename))) + { + IDirect3DRMTexture_Release(*texture); + *texture = NULL; + if (!filename) + return D3DRMERR_BADVALUE; + + return hr == D3DRMERR_BADOBJECT ? D3DRMERR_FILENOTFOUND : hr; + } + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm1_LoadTextureFromResource(IDirect3DRM *iface, + HRSRC resource, IDirect3DRMTexture **texture) +{ + struct d3drm_texture *object; + HRESULT hr; + + FIXME("iface %p, resource %p, texture %p stub!\n", iface, resource, texture); + + if (FAILED(hr = d3drm_texture_create(&object, iface))) + return hr; + + *texture = &object->IDirect3DRMTexture_iface; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm1_SetSearchPath(IDirect3DRM *iface, const char *path) +{ + FIXME("iface %p, path %s stub!\n", iface, debugstr_a(path)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm1_AddSearchPath(IDirect3DRM *iface, const char *path) +{ + FIXME("iface %p, path %s stub!\n", iface, debugstr_a(path)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm1_GetSearchPath(IDirect3DRM *iface, DWORD *size, char *path) +{ + FIXME("iface %p, size %p, path %p stub!\n", iface, size, path); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm1_SetDefaultTextureColors(IDirect3DRM *iface, DWORD color_count) +{ + FIXME("iface %p, color_count %lu stub!\n", iface, color_count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm1_SetDefaultTextureShades(IDirect3DRM *iface, DWORD shade_count) +{ + FIXME("iface %p, shade_count %lu stub!\n", iface, shade_count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm1_GetDevices(IDirect3DRM *iface, IDirect3DRMDeviceArray **array) +{ + FIXME("iface %p, array %p stub!\n", iface, array); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm1_GetNamedObject(IDirect3DRM *iface, + const char *name, IDirect3DRMObject **object) +{ + FIXME("iface %p, name %s, object %p stub!\n", iface, debugstr_a(name), object); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm1_EnumerateObjects(IDirect3DRM *iface, D3DRMOBJECTCALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm1_Load(IDirect3DRM *iface, void *source, void *object_id, IID **iids, + DWORD iid_count, D3DRMLOADOPTIONS flags, D3DRMLOADCALLBACK load_cb, void *load_ctx, + D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx, IDirect3DRMFrame *parent_frame) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM(iface); + IDirect3DRMFrame3 *parent_frame3 = NULL; + HRESULT hr = D3DRM_OK; + + TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %lu, flags %#lx, " + "load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n", + iface, source, object_id, iids, iid_count, flags, + load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame); + + if (parent_frame) + hr = IDirect3DRMFrame_QueryInterface(parent_frame, &IID_IDirect3DRMFrame3, (void **)&parent_frame3); + if (SUCCEEDED(hr)) + hr = IDirect3DRM3_Load(&d3drm->IDirect3DRM3_iface, source, object_id, iids, iid_count, + flags, load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame3); + if (parent_frame3) + IDirect3DRMFrame3_Release(parent_frame3); + + return hr; +} + +static HRESULT WINAPI d3drm1_Tick(IDirect3DRM *iface, D3DVALUE tick) +{ + FIXME("iface %p, tick %.8e stub!\n", iface, tick); + + return E_NOTIMPL; +} + +static const struct IDirect3DRMVtbl d3drm1_vtbl = +{ + d3drm1_QueryInterface, + d3drm1_AddRef, + d3drm1_Release, + d3drm1_CreateObject, + d3drm1_CreateFrame, + d3drm1_CreateMesh, + d3drm1_CreateMeshBuilder, + d3drm1_CreateFace, + d3drm1_CreateAnimation, + d3drm1_CreateAnimationSet, + d3drm1_CreateTexture, + d3drm1_CreateLight, + d3drm1_CreateLightRGB, + d3drm1_CreateMaterial, + d3drm1_CreateDevice, + d3drm1_CreateDeviceFromSurface, + d3drm1_CreateDeviceFromD3D, + d3drm1_CreateDeviceFromClipper, + d3drm1_CreateTextureFromSurface, + d3drm1_CreateShadow, + d3drm1_CreateViewport, + d3drm1_CreateWrap, + d3drm1_CreateUserVisual, + d3drm1_LoadTexture, + d3drm1_LoadTextureFromResource, + d3drm1_SetSearchPath, + d3drm1_AddSearchPath, + d3drm1_GetSearchPath, + d3drm1_SetDefaultTextureColors, + d3drm1_SetDefaultTextureShades, + d3drm1_GetDevices, + d3drm1_GetNamedObject, + d3drm1_EnumerateObjects, + d3drm1_Load, + d3drm1_Tick, +}; + +static HRESULT WINAPI d3drm2_QueryInterface(IDirect3DRM2 *iface, REFIID riid, void **out) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + + return d3drm1_QueryInterface(&d3drm->IDirect3DRM_iface, riid, out); +} + +static ULONG WINAPI d3drm2_AddRef(IDirect3DRM2 *iface) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + ULONG refcount = InterlockedIncrement(&d3drm->ref2); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + if (refcount == 1) + InterlockedIncrement(&d3drm->iface_count); + + return refcount; +} + +static ULONG WINAPI d3drm2_Release(IDirect3DRM2 *iface) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + ULONG refcount = InterlockedDecrement(&d3drm->ref2); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount && !InterlockedDecrement(&d3drm->iface_count)) + d3drm_destroy(d3drm); + + return refcount; +} + +static HRESULT WINAPI d3drm2_CreateObject(IDirect3DRM2 *iface, + REFCLSID clsid, IUnknown *outer, REFIID iid, void **out) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + + TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n", + iface, debugstr_guid(clsid), outer, debugstr_guid(iid), out); + + return IDirect3DRM3_CreateObject(&d3drm->IDirect3DRM3_iface, clsid, outer, iid, out); +} + +static HRESULT WINAPI d3drm2_CreateFrame(IDirect3DRM2 *iface, + IDirect3DRMFrame *parent_frame, IDirect3DRMFrame2 **frame) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + struct d3drm_frame *object; + HRESULT hr; + + TRACE("iface %p, parent_frame %p, frame %p.\n", iface, parent_frame, frame); + + if (FAILED(hr = d3drm_frame_create(&object, (IUnknown *)parent_frame, &d3drm->IDirect3DRM_iface))) + return hr; + + *frame = &object->IDirect3DRMFrame2_iface; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm2_CreateMesh(IDirect3DRM2 *iface, IDirect3DRMMesh **mesh) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + + TRACE("iface %p, mesh %p.\n", iface, mesh); + + return IDirect3DRM3_CreateMesh(&d3drm->IDirect3DRM3_iface, mesh); +} + +static HRESULT WINAPI d3drm2_CreateMeshBuilder(IDirect3DRM2 *iface, IDirect3DRMMeshBuilder2 **mesh_builder) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + struct d3drm_mesh_builder *object; + HRESULT hr; + + TRACE("iface %p, mesh_builder %p.\n", iface, mesh_builder); + + if (FAILED(hr = d3drm_mesh_builder_create(&object, &d3drm->IDirect3DRM_iface))) + return hr; + + *mesh_builder = &object->IDirect3DRMMeshBuilder2_iface; + + return S_OK; +} + +static HRESULT WINAPI d3drm2_CreateFace(IDirect3DRM2 *iface, IDirect3DRMFace **face) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + + TRACE("iface %p, face %p.\n", iface, face); + + return IDirect3DRM_CreateFace(&d3drm->IDirect3DRM_iface, face); +} + +static HRESULT WINAPI d3drm2_CreateAnimation(IDirect3DRM2 *iface, IDirect3DRMAnimation **animation) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + + TRACE("iface %p, animation %p.\n", iface, animation); + + return IDirect3DRM_CreateAnimation(&d3drm->IDirect3DRM_iface, animation); +} + +static HRESULT WINAPI d3drm2_CreateAnimationSet(IDirect3DRM2 *iface, IDirect3DRMAnimationSet **set) +{ + FIXME("iface %p, set %p stub!\n", iface, set); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm2_CreateTexture(IDirect3DRM2 *iface, + D3DRMIMAGE *image, IDirect3DRMTexture2 **texture) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + IDirect3DRMTexture3 *texture3; + HRESULT hr; + + TRACE("iface %p, image %p, texture %p.\n", iface, image, texture); + + if (!texture) + return D3DRMERR_BADVALUE; + + if (FAILED(hr = IDirect3DRM3_CreateTexture(&d3drm->IDirect3DRM3_iface, image, &texture3))) + { + *texture = NULL; + return hr; + } + + hr = IDirect3DRMTexture3_QueryInterface(texture3, &IID_IDirect3DRMTexture2, (void **)texture); + IDirect3DRMTexture3_Release(texture3); + + return hr; +} + +static HRESULT WINAPI d3drm2_CreateLight(IDirect3DRM2 *iface, + D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + + TRACE("iface %p, type %#x, color 0x%08lx, light %p.\n", iface, type, color, light); + + return IDirect3DRM3_CreateLight(&d3drm->IDirect3DRM3_iface, type, color, light); +} + +static HRESULT WINAPI d3drm2_CreateLightRGB(IDirect3DRM2 *iface, D3DRMLIGHTTYPE type, + D3DVALUE red, D3DVALUE green, D3DVALUE blue, IDirect3DRMLight **light) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + + TRACE("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p.\n", + iface, type, red, green, blue, light); + + return IDirect3DRM3_CreateLightRGB(&d3drm->IDirect3DRM3_iface, type, red, green, blue, light); +} + +static HRESULT WINAPI d3drm2_CreateMaterial(IDirect3DRM2 *iface, + D3DVALUE power, IDirect3DRMMaterial **material) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + + TRACE("iface %p, power %.8e, material %p.\n", iface, power, material); + + return IDirect3DRM3_CreateMaterial(&d3drm->IDirect3DRM3_iface, power, (IDirect3DRMMaterial2 **)material); +} + +static HRESULT WINAPI d3drm2_CreateDevice(IDirect3DRM2 *iface, + DWORD width, DWORD height, IDirect3DRMDevice2 **device) +{ + TRACE("iface %p, width %lu, height %lu, device %p.\n", iface, width, height, device); + + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + + return D3DRMERR_BADDEVICE; +} + +static HRESULT WINAPI d3drm2_CreateDeviceFromSurface(IDirect3DRM2 *iface, GUID *guid, + IDirectDraw *ddraw, IDirectDrawSurface *backbuffer, IDirect3DRMDevice2 **device) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + IDirect3DRMDevice3 *device3; + HRESULT hr; + TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, device %p.\n", + iface, debugstr_guid(guid), ddraw, backbuffer, device); + + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + hr = IDirect3DRM3_CreateDeviceFromSurface(&d3drm->IDirect3DRM3_iface, guid, ddraw, backbuffer, 0, &device3); + if (FAILED(hr)) + return hr; + + hr = IDirect3DRMDevice3_QueryInterface(device3, &IID_IDirect3DRMDevice2, (void**)device); + IDirect3DRMDevice3_Release(device3); + + return hr; +} + +static HRESULT WINAPI d3drm2_CreateDeviceFromD3D(IDirect3DRM2 *iface, + IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device, IDirect3DRMDevice2 **device) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + IDirect3DRMDevice3 *device3; + HRESULT hr; + + TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n", + iface, d3d, d3d_device, device); + + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + + hr = IDirect3DRM3_CreateDeviceFromD3D(&d3drm->IDirect3DRM3_iface, d3d, d3d_device, &device3); + if (FAILED(hr)) + return hr; + + hr = IDirect3DRMDevice3_QueryInterface(device3, &IID_IDirect3DRMDevice2, (void **)device); + IDirect3DRMDevice3_Release(device3); + + return hr; +} + +static HRESULT WINAPI d3drm2_CreateDeviceFromClipper(IDirect3DRM2 *iface, + IDirectDrawClipper *clipper, GUID *guid, int width, int height, + IDirect3DRMDevice2 **device) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + IDirect3DRMDevice3 *device3; + HRESULT hr; + + TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n", + iface, clipper, debugstr_guid(guid), width, height, device); + + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + hr = IDirect3DRM3_CreateDeviceFromClipper(&d3drm->IDirect3DRM3_iface, clipper, guid, width, height, &device3); + if (FAILED(hr)) + return hr; + + hr = IDirect3DRMDevice3_QueryInterface(device3, &IID_IDirect3DRMDevice2, (void**)device); + IDirect3DRMDevice3_Release(device3); + + return hr; +} + +static HRESULT WINAPI d3drm2_CreateTextureFromSurface(IDirect3DRM2 *iface, + IDirectDrawSurface *surface, IDirect3DRMTexture2 **texture) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + IDirect3DRMTexture3 *texture3; + HRESULT hr; + + TRACE("iface %p, surface %p, texture %p.\n", iface, surface, texture); + + if (!texture) + return D3DRMERR_BADVALUE; + + if (FAILED(hr = IDirect3DRM3_CreateTextureFromSurface(&d3drm->IDirect3DRM3_iface, surface, &texture3))) + { + *texture = NULL; + return hr; + } + + hr = IDirect3DRMTexture3_QueryInterface(texture3, &IID_IDirect3DRMTexture2, (void **)texture); + IDirect3DRMTexture3_Release(texture3); + + return hr; +} + +static HRESULT WINAPI d3drm2_CreateShadow(IDirect3DRM2 *iface, IDirect3DRMVisual *visual, + IDirect3DRMLight *light, D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, + IDirect3DRMVisual **shadow) +{ + FIXME("iface %p, visual %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n", + iface, visual, light, px, py, pz, nx, ny, nz, shadow); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm2_CreateViewport(IDirect3DRM2 *iface, IDirect3DRMDevice *device, + IDirect3DRMFrame *camera, DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport **viewport) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + IDirect3DRMDevice3 *device3; + IDirect3DRMFrame3 *camera3; + IDirect3DRMViewport2 *viewport2; + HRESULT hr; + + TRACE("iface %p, device %p, camera %p, x %lu, y %lu, width %lu, height %lu, viewport %p.\n", + iface, device, camera, x, y, width, height, viewport); + + if (!viewport) + return D3DRMERR_BADVALUE; + *viewport = NULL; + + if (!device || !camera) + return D3DRMERR_BADOBJECT; + + if (FAILED(hr = IDirect3DRMDevice_QueryInterface(device, &IID_IDirect3DRMDevice3, (void **)&device3))) + return hr; + + if (FAILED(hr = IDirect3DRMFrame_QueryInterface(camera, &IID_IDirect3DRMFrame3, (void **)&camera3))) + { + IDirect3DRMDevice3_Release(device3); + return hr; + } + + hr = IDirect3DRM3_CreateViewport(&d3drm->IDirect3DRM3_iface, device3, camera3, x, y, width, height, &viewport2); + IDirect3DRMDevice3_Release(device3); + IDirect3DRMFrame3_Release(camera3); + if (FAILED(hr)) + return hr; + + hr = IDirect3DRMViewport2_QueryInterface(viewport2, &IID_IDirect3DRMViewport, (void **)viewport); + IDirect3DRMViewport2_Release(viewport2); + + return hr; +} + +static HRESULT WINAPI d3drm2_CreateWrap(IDirect3DRM2 *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame *frame, + D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, D3DVALUE ou, D3DVALUE ov, D3DVALUE su, D3DVALUE sv, + IDirect3DRMWrap **wrap) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + + TRACE("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, " + "ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p.\n", + iface, type, frame, ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv, wrap); + + return IDirect3DRM_CreateWrap(&d3drm->IDirect3DRM_iface, type, frame, ox, oy, oz, dx, dy, dz, ux, uy, uz, + ou, ov, su, sv, wrap); +} + +static HRESULT WINAPI d3drm2_CreateUserVisual(IDirect3DRM2 *iface, + D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual) +{ + FIXME("iface %p, cb %p, ctx %p, visual %p stub!\n", iface, cb, ctx, visual); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm2_LoadTexture(IDirect3DRM2 *iface, + const char *filename, IDirect3DRMTexture2 **texture) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + IDirect3DRMTexture3 *texture3; + HRESULT hr; + + TRACE("iface %p, filename %s, texture %p.\n", iface, debugstr_a(filename), texture); + + if (!texture) + return D3DRMERR_BADVALUE; + + if (FAILED(hr = IDirect3DRM3_LoadTexture(&d3drm->IDirect3DRM3_iface, filename, &texture3))) + { + *texture = NULL; + return hr; + } + + hr = IDirect3DRMTexture3_QueryInterface(texture3, &IID_IDirect3DRMTexture2, (void **)texture); + IDirect3DRMTexture3_Release(texture3); + + return hr; +} + +static HRESULT WINAPI d3drm2_LoadTextureFromResource(IDirect3DRM2 *iface, HMODULE module, + const char *resource_name, const char *resource_type, IDirect3DRMTexture2 **texture) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + struct d3drm_texture *object; + HRESULT hr; + + FIXME("iface %p, resource_name %s, resource_type %s, texture %p stub!\n", + iface, debugstr_a(resource_name), debugstr_a(resource_type), texture); + + if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface))) + return hr; + + *texture = &object->IDirect3DRMTexture2_iface; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm2_SetSearchPath(IDirect3DRM2 *iface, const char *path) +{ + FIXME("iface %p, path %s stub!\n", iface, debugstr_a(path)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm2_AddSearchPath(IDirect3DRM2 *iface, const char *path) +{ + FIXME("iface %p, path %s stub!\n", iface, debugstr_a(path)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm2_GetSearchPath(IDirect3DRM2 *iface, DWORD *size, char *path) +{ + FIXME("iface %p, size %p, path %p stub!\n", iface, size, path); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm2_SetDefaultTextureColors(IDirect3DRM2 *iface, DWORD color_count) +{ + FIXME("iface %p, color_count %lu stub!\n", iface, color_count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm2_SetDefaultTextureShades(IDirect3DRM2 *iface, DWORD shade_count) +{ + FIXME("iface %p, shade_count %lu stub!\n", iface, shade_count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm2_GetDevices(IDirect3DRM2 *iface, IDirect3DRMDeviceArray **array) +{ + FIXME("iface %p, array %p stub!\n", iface, array); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm2_GetNamedObject(IDirect3DRM2 *iface, + const char *name, IDirect3DRMObject **object) +{ + FIXME("iface %p, name %s, object %p stub!\n", iface, debugstr_a(name), object); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm2_EnumerateObjects(IDirect3DRM2 *iface, D3DRMOBJECTCALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm2_Load(IDirect3DRM2 *iface, void *source, void *object_id, IID **iids, + DWORD iid_count, D3DRMLOADOPTIONS flags, D3DRMLOADCALLBACK load_cb, void *load_ctx, + D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx, IDirect3DRMFrame *parent_frame) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + IDirect3DRMFrame3 *parent_frame3 = NULL; + HRESULT hr = D3DRM_OK; + + TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %lu, flags %#lx, " + "load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n", + iface, source, object_id, iids, iid_count, flags, + load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame); + + if (parent_frame) + hr = IDirect3DRMFrame_QueryInterface(parent_frame, &IID_IDirect3DRMFrame3, (void **)&parent_frame3); + if (SUCCEEDED(hr)) + hr = IDirect3DRM3_Load(&d3drm->IDirect3DRM3_iface, source, object_id, iids, iid_count, + flags, load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame3); + if (parent_frame3) + IDirect3DRMFrame3_Release(parent_frame3); + + return hr; +} + +static HRESULT WINAPI d3drm2_Tick(IDirect3DRM2 *iface, D3DVALUE tick) +{ + FIXME("iface %p, tick %.8e stub!\n", iface, tick); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm2_CreateProgressiveMesh(IDirect3DRM2 *iface, IDirect3DRMProgressiveMesh **mesh) +{ + FIXME("iface %p, mesh %p stub!\n", iface, mesh); + + return E_NOTIMPL; +} + +static const struct IDirect3DRM2Vtbl d3drm2_vtbl = +{ + d3drm2_QueryInterface, + d3drm2_AddRef, + d3drm2_Release, + d3drm2_CreateObject, + d3drm2_CreateFrame, + d3drm2_CreateMesh, + d3drm2_CreateMeshBuilder, + d3drm2_CreateFace, + d3drm2_CreateAnimation, + d3drm2_CreateAnimationSet, + d3drm2_CreateTexture, + d3drm2_CreateLight, + d3drm2_CreateLightRGB, + d3drm2_CreateMaterial, + d3drm2_CreateDevice, + d3drm2_CreateDeviceFromSurface, + d3drm2_CreateDeviceFromD3D, + d3drm2_CreateDeviceFromClipper, + d3drm2_CreateTextureFromSurface, + d3drm2_CreateShadow, + d3drm2_CreateViewport, + d3drm2_CreateWrap, + d3drm2_CreateUserVisual, + d3drm2_LoadTexture, + d3drm2_LoadTextureFromResource, + d3drm2_SetSearchPath, + d3drm2_AddSearchPath, + d3drm2_GetSearchPath, + d3drm2_SetDefaultTextureColors, + d3drm2_SetDefaultTextureShades, + d3drm2_GetDevices, + d3drm2_GetNamedObject, + d3drm2_EnumerateObjects, + d3drm2_Load, + d3drm2_Tick, + d3drm2_CreateProgressiveMesh, +}; + +static HRESULT WINAPI d3drm3_QueryInterface(IDirect3DRM3 *iface, REFIID riid, void **out) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + + return d3drm1_QueryInterface(&d3drm->IDirect3DRM_iface, riid, out); +} + +static ULONG WINAPI d3drm3_AddRef(IDirect3DRM3 *iface) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + ULONG refcount = InterlockedIncrement(&d3drm->ref3); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + if (refcount == 1) + InterlockedIncrement(&d3drm->iface_count); + + return refcount; +} + +static ULONG WINAPI d3drm3_Release(IDirect3DRM3 *iface) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + ULONG refcount = InterlockedDecrement(&d3drm->ref3); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount && !InterlockedDecrement(&d3drm->iface_count)) + d3drm_destroy(d3drm); + + return refcount; +} + +static HRESULT WINAPI d3drm3_CreateObject(IDirect3DRM3 *iface, + REFCLSID clsid, IUnknown *outer, REFIID iid, void **out) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + IUnknown *object; + unsigned int i; + HRESULT hr; + + static const struct + { + const CLSID *clsid; + HRESULT (*create_object)(void **object, IDirect3DRM *d3drm); + } + object_table[] = + { + {&CLSID_CDirect3DRMTexture, d3drm_create_texture_object}, + {&CLSID_CDirect3DRMDevice, d3drm_create_device_object}, + {&CLSID_CDirect3DRMViewport, d3drm_create_viewport_object}, + {&CLSID_CDirect3DRMFace, d3drm_create_face_object}, + {&CLSID_CDirect3DRMMeshBuilder, d3drm_create_mesh_builder_object}, + {&CLSID_CDirect3DRMFrame, d3drm_create_frame_object}, + {&CLSID_CDirect3DRMLight, d3drm_create_light_object}, + {&CLSID_CDirect3DRMMaterial, d3drm_create_material_object}, + {&CLSID_CDirect3DRMMesh, d3drm_create_mesh_object}, + {&CLSID_CDirect3DRMAnimation, d3drm_create_animation_object}, + {&CLSID_CDirect3DRMWrap, d3drm_create_wrap_object}, + }; + + TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n", + iface, debugstr_guid(clsid), outer, debugstr_guid(iid), out); + + if (!out) + return D3DRMERR_BADVALUE; + + if (!clsid || !iid) + { + *out = NULL; + return D3DRMERR_BADVALUE; + } + + if (outer) + { + FIXME("COM aggregation for outer IUnknown (%p) not implemented. Returning E_NOTIMPL.\n", outer); + *out = NULL; + return E_NOTIMPL; + } + + for (i = 0; i < ARRAYSIZE(object_table); ++i) + { + if (IsEqualGUID(clsid, object_table[i].clsid)) + { + if (FAILED(hr = object_table[i].create_object((void **)&object, &d3drm->IDirect3DRM_iface))) + { + *out = NULL; + return hr; + } + break; + } + } + if (i == ARRAYSIZE(object_table)) + { + FIXME("%s not implemented. Returning CLASSFACTORY_E_FIRST.\n", debugstr_guid(clsid)); + *out = NULL; + return CLASSFACTORY_E_FIRST; + } + + if (FAILED(hr = IUnknown_QueryInterface(object, iid, out))) + *out = NULL; + IUnknown_Release(object); + + return hr; +} + +static HRESULT WINAPI d3drm3_CreateFrame(IDirect3DRM3 *iface, + IDirect3DRMFrame3 *parent, IDirect3DRMFrame3 **frame) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_frame *object; + HRESULT hr; + + TRACE("iface %p, parent %p, frame %p.\n", iface, parent, frame); + + if (FAILED(hr = d3drm_frame_create(&object, (IUnknown *)parent, &d3drm->IDirect3DRM_iface))) + return hr; + + *frame = &object->IDirect3DRMFrame3_iface; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm3_CreateMesh(IDirect3DRM3 *iface, IDirect3DRMMesh **mesh) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_mesh *object; + HRESULT hr; + + TRACE("iface %p, mesh %p.\n", iface, mesh); + + if (FAILED(hr = d3drm_mesh_create(&object, &d3drm->IDirect3DRM_iface))) + return hr; + + *mesh = &object->IDirect3DRMMesh_iface; + + return S_OK; +} + +static HRESULT WINAPI d3drm3_CreateMeshBuilder(IDirect3DRM3 *iface, IDirect3DRMMeshBuilder3 **mesh_builder) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_mesh_builder *object; + HRESULT hr; + + TRACE("iface %p, mesh_builder %p.\n", iface, mesh_builder); + + if (FAILED(hr = d3drm_mesh_builder_create(&object, &d3drm->IDirect3DRM_iface))) + return hr; + + *mesh_builder = &object->IDirect3DRMMeshBuilder3_iface; + + return S_OK; +} + +static HRESULT WINAPI d3drm3_CreateFace(IDirect3DRM3 *iface, IDirect3DRMFace2 **face) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + IDirect3DRMFace *face1; + HRESULT hr; + + TRACE("iface %p, face %p.\n", iface, face); + + if (FAILED(hr = IDirect3DRM_CreateFace(&d3drm->IDirect3DRM_iface, &face1))) + return hr; + + hr = IDirect3DRMFace_QueryInterface(face1, &IID_IDirect3DRMFace2, (void **)face); + IDirect3DRMFace_Release(face1); + + return hr; +} + +static HRESULT WINAPI d3drm3_CreateAnimation(IDirect3DRM3 *iface, IDirect3DRMAnimation2 **animation) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_animation *object; + HRESULT hr; + + TRACE("iface %p, animation %p.\n", iface, animation); + + if (FAILED(hr = d3drm_animation_create(&object, &d3drm->IDirect3DRM_iface))) + return hr; + + *animation = &object->IDirect3DRMAnimation2_iface; + + return hr; +} + +static HRESULT WINAPI d3drm3_CreateAnimationSet(IDirect3DRM3 *iface, IDirect3DRMAnimationSet2 **set) +{ + FIXME("iface %p, set %p stub!\n", iface, set); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_CreateTexture(IDirect3DRM3 *iface, + D3DRMIMAGE *image, IDirect3DRMTexture3 **texture) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_texture *object; + HRESULT hr; + + TRACE("iface %p, image %p, texture %p.\n", iface, image, texture); + + if (!texture) + return D3DRMERR_BADVALUE; + + if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface))) + return hr; + + *texture = &object->IDirect3DRMTexture3_iface; + + if (FAILED(IDirect3DRMTexture3_InitFromImage(*texture, image))) + { + IDirect3DRMTexture3_Release(*texture); + *texture = NULL; + return D3DRMERR_BADVALUE; + } + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm3_CreateLight(IDirect3DRM3 *iface, + D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_light *object; + HRESULT hr; + + TRACE("iface %p, type %#x, color 0x%08lx, light %p.\n", iface, type, color, light); + + if (SUCCEEDED(hr = d3drm_light_create(&object, &d3drm->IDirect3DRM_iface))) + { + IDirect3DRMLight_SetType(&object->IDirect3DRMLight_iface, type); + IDirect3DRMLight_SetColor(&object->IDirect3DRMLight_iface, color); + } + + *light = &object->IDirect3DRMLight_iface; + + return hr; +} + +static HRESULT WINAPI d3drm3_CreateLightRGB(IDirect3DRM3 *iface, D3DRMLIGHTTYPE type, + D3DVALUE red, D3DVALUE green, D3DVALUE blue, IDirect3DRMLight **light) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_light *object; + HRESULT hr; + + TRACE("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p.\n", + iface, type, red, green, blue, light); + + if (SUCCEEDED(hr = d3drm_light_create(&object, &d3drm->IDirect3DRM_iface))) + { + IDirect3DRMLight_SetType(&object->IDirect3DRMLight_iface, type); + IDirect3DRMLight_SetColorRGB(&object->IDirect3DRMLight_iface, red, green, blue); + } + + *light = &object->IDirect3DRMLight_iface; + + return hr; +} + +static HRESULT WINAPI d3drm3_CreateMaterial(IDirect3DRM3 *iface, + D3DVALUE power, IDirect3DRMMaterial2 **material) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_material *object; + HRESULT hr; + + TRACE("iface %p, power %.8e, material %p.\n", iface, power, material); + + if (SUCCEEDED(hr = d3drm_material_create(&object, &d3drm->IDirect3DRM_iface))) + IDirect3DRMMaterial2_SetPower(&object->IDirect3DRMMaterial2_iface, power); + + *material = &object->IDirect3DRMMaterial2_iface; + + return hr; +} + +static HRESULT WINAPI d3drm3_CreateDevice(IDirect3DRM3 *iface, + DWORD width, DWORD height, IDirect3DRMDevice3 **device) +{ + TRACE("iface %p, width %lu, height %lu, device %p.\n", iface, width, height, device); + + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + + return D3DRMERR_BADDEVICE; +} + +static HRESULT WINAPI d3drm3_CreateDeviceFromSurface(IDirect3DRM3 *iface, GUID *guid, + IDirectDraw *ddraw, IDirectDrawSurface *backbuffer, DWORD flags, IDirect3DRMDevice3 **device) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_device *object; + BOOL use_z_surface; + HRESULT hr; + + TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, flags %#lx, device %p.\n", + iface, debugstr_guid(guid), ddraw, backbuffer, flags, device); + + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + + if (!backbuffer || !ddraw) + return D3DRMERR_BADDEVICE; + + if (FAILED(hr = d3drm_device_create(&object, &d3drm->IDirect3DRM_iface))) + return hr; + + use_z_surface = !(flags & D3DRMDEVICE_NOZBUFFER); + + if (SUCCEEDED(hr = d3drm_device_init(object, 3, ddraw, backbuffer, use_z_surface))) + *device = &object->IDirect3DRMDevice3_iface; + else + d3drm_device_destroy(object); + + return hr; +} + +static HRESULT WINAPI d3drm3_CreateDeviceFromD3D(IDirect3DRM3 *iface, + IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device, IDirect3DRMDevice3 **device) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_device *object; + HRESULT hr; + + TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n", + iface, d3d, d3d_device, device); + + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + + if (FAILED(hr = d3drm_device_create(&object, &d3drm->IDirect3DRM_iface))) + return hr; + + if (FAILED(hr = IDirect3DRMDevice3_InitFromD3D2(&object->IDirect3DRMDevice3_iface, d3d, d3d_device))) + { + d3drm_device_destroy(object); + return hr; + } + *device = &object->IDirect3DRMDevice3_iface; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm3_CreateDeviceFromClipper(IDirect3DRM3 *iface, + IDirectDrawClipper *clipper, GUID *guid, int width, int height, + IDirect3DRMDevice3 **device) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_device *object; + IDirectDraw *ddraw; + IDirectDrawSurface *render_target; + HRESULT hr; + + TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n", + iface, clipper, debugstr_guid(guid), width, height, device); + + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + + if (!clipper || !width || !height) + return D3DRMERR_BADVALUE; + + hr = DirectDrawCreate(NULL, &ddraw, NULL); + if (FAILED(hr)) + return hr; + + if (FAILED(hr = d3drm_device_create(&object, &d3drm->IDirect3DRM_iface))) + { + IDirectDraw_Release(ddraw); + return hr; + } + + hr = d3drm_device_create_surfaces_from_clipper(object, ddraw, clipper, width, height, &render_target); + if (FAILED(hr)) + { + IDirectDraw_Release(ddraw); + d3drm_device_destroy(object); + return hr; + } + + hr = d3drm_device_init(object, 3, ddraw, render_target, TRUE); + IDirectDraw_Release(ddraw); + IDirectDrawSurface_Release(render_target); + if (FAILED(hr)) + d3drm_device_destroy(object); + else + *device = &object->IDirect3DRMDevice3_iface; + + return hr; +} + +static HRESULT WINAPI d3drm3_CreateShadow(IDirect3DRM3 *iface, IUnknown *object, IDirect3DRMLight *light, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, IDirect3DRMShadow2 **shadow) +{ + FIXME("iface %p, object %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n", + iface, object, light, px, py, pz, nx, ny, nz, shadow); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_CreateTextureFromSurface(IDirect3DRM3 *iface, + IDirectDrawSurface *surface, IDirect3DRMTexture3 **texture) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_texture *object; + HRESULT hr; + + TRACE("iface %p, surface %p, texture %p.\n", iface, surface, texture); + + if (!texture) + return D3DRMERR_BADVALUE; + + if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface))) + return hr; + + *texture = &object->IDirect3DRMTexture3_iface; + + if (FAILED(IDirect3DRMTexture3_InitFromSurface(*texture, surface))) + { + IDirect3DRMTexture3_Release(*texture); + *texture = NULL; + return D3DRMERR_BADVALUE; + } + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm3_CreateViewport(IDirect3DRM3 *iface, IDirect3DRMDevice3 *device, + IDirect3DRMFrame3 *camera, DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport2 **viewport) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_viewport *object; + HRESULT hr; + + TRACE("iface %p, device %p, camera %p, x %lu, y %lu, width %lu, height %lu, viewport %p.\n", + iface, device, camera, x, y, width, height, viewport); + + if (!viewport) + return D3DRMERR_BADVALUE; + *viewport = NULL; + + if (!device || !camera) + return D3DRMERR_BADOBJECT; + + if (FAILED(hr = d3drm_viewport_create(&object, &d3drm->IDirect3DRM_iface))) + return hr; + + *viewport = &object->IDirect3DRMViewport2_iface; + + if (FAILED(hr = IDirect3DRMViewport2_Init(*viewport, device, camera, x, y, width, height))) + { + IDirect3DRMViewport2_Release(*viewport); + *viewport = NULL; + return D3DRMERR_BADVALUE; + } + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm3_CreateWrap(IDirect3DRM3 *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame3 *frame, + D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, D3DVALUE ou, D3DVALUE ov, D3DVALUE su, D3DVALUE sv, + IDirect3DRMWrap **wrap) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_wrap *object; + HRESULT hr; + + FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, " + "ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p, semi-stub.\n", + iface, type, frame, ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv, wrap); + + if (!wrap) + return D3DRMERR_BADVALUE; + + if (FAILED(hr = d3drm_wrap_create(&object, &d3drm->IDirect3DRM_iface))) + return hr; + + *wrap = &object->IDirect3DRMWrap_iface; + + return S_OK; +} + +static HRESULT WINAPI d3drm3_CreateUserVisual(IDirect3DRM3 *iface, + D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual) +{ + FIXME("iface %p, cb %p, ctx %p, visual %p stub!\n", iface, cb, ctx, visual); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_LoadTexture(IDirect3DRM3 *iface, + const char *filename, IDirect3DRMTexture3 **texture) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_texture *object; + HRESULT hr; + + TRACE("iface %p, filename %s, texture %p.\n", iface, debugstr_a(filename), texture); + + if (!texture) + return D3DRMERR_BADVALUE; + + if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface))) + return hr; + + *texture = &object->IDirect3DRMTexture3_iface; + if (FAILED(hr = IDirect3DRMTexture3_InitFromFile(*texture, filename))) + { + IDirect3DRMTexture3_Release(*texture); + *texture = NULL; + return hr == D3DRMERR_BADOBJECT ? D3DRMERR_FILENOTFOUND : hr; + } + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm3_LoadTextureFromResource(IDirect3DRM3 *iface, HMODULE module, + const char *resource_name, const char *resource_type, IDirect3DRMTexture3 **texture) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_texture *object; + HRESULT hr; + + FIXME("iface %p, module %p, resource_name %s, resource_type %s, texture %p stub!\n", + iface, module, debugstr_a(resource_name), debugstr_a(resource_type), texture); + + if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface))) + return hr; + + *texture = &object->IDirect3DRMTexture3_iface; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm3_SetSearchPath(IDirect3DRM3 *iface, const char *path) +{ + FIXME("iface %p, path %s stub!\n", iface, debugstr_a(path)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_AddSearchPath(IDirect3DRM3 *iface, const char *path) +{ + FIXME("iface %p, path %s stub!\n", iface, debugstr_a(path)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_GetSearchPath(IDirect3DRM3 *iface, DWORD *size, char *path) +{ + FIXME("iface %p, size %p, path %p stub!\n", iface, size, path); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_SetDefaultTextureColors(IDirect3DRM3 *iface, DWORD color_count) +{ + FIXME("iface %p, color_count %lu stub!\n", iface, color_count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_SetDefaultTextureShades(IDirect3DRM3 *iface, DWORD shade_count) +{ + FIXME("iface %p, shade_count %lu stub!\n", iface, shade_count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_GetDevices(IDirect3DRM3 *iface, IDirect3DRMDeviceArray **array) +{ + FIXME("iface %p, array %p stub!\n", iface, array); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_GetNamedObject(IDirect3DRM3 *iface, + const char *name, IDirect3DRMObject **object) +{ + FIXME("iface %p, name %s, object %p stub!\n", iface, debugstr_a(name), object); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_EnumerateObjects(IDirect3DRM3 *iface, D3DRMOBJECTCALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT load_data(IDirect3DRM3 *iface, IDirectXFileData *data_object, IID **GUIDs, DWORD nb_GUIDs, D3DRMLOADCALLBACK LoadProc, + void *ArgLP, D3DRMLOADTEXTURECALLBACK LoadTextureProc, void *ArgLTP, IDirect3DRMFrame3 *parent_frame) +{ + HRESULT ret = D3DRMERR_BADOBJECT; + HRESULT hr; + const GUID* guid; + DWORD i; + BOOL requested = FALSE; + + hr = IDirectXFileData_GetType(data_object, &guid); + if (hr != DXFILE_OK) + goto end; + + TRACE("Found object type whose GUID = %s\n", debugstr_guid(guid)); + + /* Load object only if it is top level and requested or if it is part of another object */ + + if (IsEqualGUID(guid, &TID_D3DRMMesh)) + { + TRACE("Found TID_D3DRMMesh\n"); + + for (i = 0; i < nb_GUIDs; i++) + if (IsEqualGUID(GUIDs[i], &IID_IDirect3DRMMeshBuilder) || + IsEqualGUID(GUIDs[i], &IID_IDirect3DRMMeshBuilder2) || + IsEqualGUID(GUIDs[i], &IID_IDirect3DRMMeshBuilder3)) + { + requested = TRUE; + break; + } + + if (requested || parent_frame) + { + IDirect3DRMMeshBuilder3 *meshbuilder; + + TRACE("Load mesh data\n"); + + hr = IDirect3DRM3_CreateMeshBuilder(iface, &meshbuilder); + if (SUCCEEDED(hr)) + { + hr = load_mesh_data(meshbuilder, data_object, LoadTextureProc, ArgLTP); + if (SUCCEEDED(hr)) + { + /* Only top level objects are notified */ + if (!parent_frame) + { + IDirect3DRMObject *object; + + hr = IDirect3DRMMeshBuilder3_QueryInterface(meshbuilder, GUIDs[i], (void**)&object); + if (SUCCEEDED(hr)) + { + LoadProc(object, GUIDs[i], ArgLP); + IDirect3DRMObject_Release(object); + } + } + else + { + IDirect3DRMFrame3_AddVisual(parent_frame, (IUnknown*)meshbuilder); + } + } + IDirect3DRMMeshBuilder3_Release(meshbuilder); + } + + if (FAILED(hr)) + ERR("Cannot process mesh\n"); + } + } + else if (IsEqualGUID(guid, &TID_D3DRMFrame)) + { + TRACE("Found TID_D3DRMFrame\n"); + + for (i = 0; i < nb_GUIDs; i++) + if (IsEqualGUID(GUIDs[i], &IID_IDirect3DRMFrame) || + IsEqualGUID(GUIDs[i], &IID_IDirect3DRMFrame2) || + IsEqualGUID(GUIDs[i], &IID_IDirect3DRMFrame3)) + { + requested = TRUE; + break; + } + + if (requested || parent_frame) + { + IDirect3DRMFrame3 *frame; + + TRACE("Load frame data\n"); + + hr = IDirect3DRM3_CreateFrame(iface, parent_frame, &frame); + if (SUCCEEDED(hr)) + { + IDirectXFileObject *child; + + while (SUCCEEDED(hr = IDirectXFileData_GetNextObject(data_object, &child))) + { + IDirectXFileData *data; + IDirectXFileDataReference *reference; + IDirectXFileBinary *binary; + + if (SUCCEEDED(IDirectXFileObject_QueryInterface(child, + &IID_IDirectXFileBinary, (void **)&binary))) + { + FIXME("Binary Object not supported yet\n"); + IDirectXFileBinary_Release(binary); + } + else if (SUCCEEDED(IDirectXFileObject_QueryInterface(child, + &IID_IDirectXFileData, (void **)&data))) + { + TRACE("Found Data Object\n"); + hr = load_data(iface, data, GUIDs, nb_GUIDs, LoadProc, ArgLP, LoadTextureProc, ArgLTP, frame); + IDirectXFileData_Release(data); + } + else if (SUCCEEDED(IDirectXFileObject_QueryInterface(child, + &IID_IDirectXFileDataReference, (void **)&reference))) + { + TRACE("Found Data Object Reference\n"); + IDirectXFileDataReference_Resolve(reference, &data); + hr = load_data(iface, data, GUIDs, nb_GUIDs, LoadProc, ArgLP, LoadTextureProc, ArgLTP, frame); + IDirectXFileData_Release(data); + IDirectXFileDataReference_Release(reference); + } + IDirectXFileObject_Release(child); + } + + if (hr != DXFILEERR_NOMOREOBJECTS) + { + IDirect3DRMFrame3_Release(frame); + goto end; + } + hr = S_OK; + + /* Only top level objects are notified */ + if (!parent_frame) + { + IDirect3DRMObject *object; + + hr = IDirect3DRMFrame3_QueryInterface(frame, GUIDs[i], (void**)&object); + if (SUCCEEDED(hr)) + { + LoadProc(object, GUIDs[i], ArgLP); + IDirect3DRMObject_Release(object); + } + } + IDirect3DRMFrame3_Release(frame); + } + + if (FAILED(hr)) + ERR("Cannot process frame\n"); + } + } + else if (IsEqualGUID(guid, &TID_D3DRMMaterial)) + { + TRACE("Found TID_D3DRMMaterial\n"); + + /* Cannot be requested so nothing to do */ + } + else if (IsEqualGUID(guid, &TID_D3DRMFrameTransformMatrix)) + { + TRACE("Found TID_D3DRMFrameTransformMatrix\n"); + + /* Cannot be requested */ + if (parent_frame) + { + D3DRMMATRIX4D *matrix; + DWORD size; + + TRACE("Load Frame Transform Matrix data\n"); + + hr = IDirectXFileData_GetData(data_object, NULL, &size, (void**)&matrix); + if ((hr != DXFILE_OK) || (size != sizeof(matrix))) + goto end; + + hr = IDirect3DRMFrame3_AddTransform(parent_frame, D3DRMCOMBINE_REPLACE, *matrix); + if (FAILED(hr)) + goto end; + } + } + else + { + FIXME("Found unknown TID %s\n", debugstr_guid(guid)); + } + + ret = D3DRM_OK; + +end: + + return ret; +} + +static HRESULT WINAPI d3drm3_Load(IDirect3DRM3 *iface, void *source, void *object_id, IID **iids, + DWORD iid_count, D3DRMLOADOPTIONS flags, D3DRMLOADCALLBACK load_cb, void *load_ctx, + D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx, IDirect3DRMFrame3 *parent_frame) +{ + DXFILELOADOPTIONS load_options; + IDirectXFile *file = NULL; + IDirectXFileEnumObject *enum_object = NULL; + IDirectXFileData *data = NULL; + HRESULT hr; + const GUID* pGuid; + DWORD size; + struct d3drm_file_header *header; + HRESULT ret = D3DRMERR_BADOBJECT; + DWORD i; + + TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %lu, flags %#lx, " + "load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n", + iface, source, object_id, iids, iid_count, flags, + load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame); + + TRACE("Looking for GUIDs:\n"); + for (i = 0; i < iid_count; ++i) + TRACE("- %s (%s)\n", debugstr_guid(iids[i]), get_IID_string(iids[i])); + + if (flags == D3DRMLOAD_FROMMEMORY) + { + load_options = DXFILELOAD_FROMMEMORY; + } + else if (flags == D3DRMLOAD_FROMFILE) + { + load_options = DXFILELOAD_FROMFILE; + TRACE("Loading from file %s\n", debugstr_a(source)); + } + else + { + FIXME("Load options %#lx not supported yet.\n", flags); + return E_NOTIMPL; + } + + hr = DirectXFileCreate(&file); + if (hr != DXFILE_OK) + goto end; + + hr = IDirectXFile_RegisterTemplates(file, templates, strlen(templates)); + if (hr != DXFILE_OK) + goto end; + + hr = IDirectXFile_CreateEnumObject(file, source, load_options, &enum_object); + if (hr != DXFILE_OK) + goto end; + + hr = IDirectXFileEnumObject_GetNextDataObject(enum_object, &data); + if (hr != DXFILE_OK) + goto end; + + hr = IDirectXFileData_GetType(data, &pGuid); + if (hr != DXFILE_OK) + goto end; + + TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid)); + + if (!IsEqualGUID(pGuid, &TID_DXFILEHeader)) + { + ret = D3DRMERR_BADFILE; + goto end; + } + + hr = IDirectXFileData_GetData(data, NULL, &size, (void **)&header); + if ((hr != DXFILE_OK) || (size != sizeof(*header))) + goto end; + + TRACE("Version is %u.%u, flags %#lx.\n", header->major, header->minor, header->flags); + + /* Version must be 1.0.x */ + if ((header->major != 1) || (header->minor != 0)) + { + ret = D3DRMERR_BADFILE; + goto end; + } + + IDirectXFileData_Release(data); + data = NULL; + + while (1) + { + hr = IDirectXFileEnumObject_GetNextDataObject(enum_object, &data); + if (hr == DXFILEERR_NOMOREOBJECTS) + { + TRACE("No more object\n"); + break; + } + else if (hr != DXFILE_OK) + { + ret = D3DRMERR_BADFILE; + goto end; + } + + ret = load_data(iface, data, iids, iid_count, load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame); + if (ret != D3DRM_OK) + goto end; + + IDirectXFileData_Release(data); + data = NULL; + } + + ret = D3DRM_OK; + +end: + if (data) + IDirectXFileData_Release(data); + if (enum_object) + IDirectXFileEnumObject_Release(enum_object); + if (file) + IDirectXFile_Release(file); + + return ret; +} + +static HRESULT WINAPI d3drm3_Tick(IDirect3DRM3 *iface, D3DVALUE tick) +{ + FIXME("iface %p, tick %.8e stub!\n", iface, tick); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_CreateProgressiveMesh(IDirect3DRM3 *iface, IDirect3DRMProgressiveMesh **mesh) +{ + FIXME("iface %p, mesh %p stub!\n", iface, mesh); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_RegisterClient(IDirect3DRM3 *iface, REFGUID guid, DWORD *id) +{ + FIXME("iface %p, guid %s, id %p stub!\n", iface, debugstr_guid(guid), id); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_UnregisterClient(IDirect3DRM3 *iface, REFGUID guid) +{ + FIXME("iface %p, guid %s stub!\n", iface, debugstr_guid(guid)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_CreateClippedVisual(IDirect3DRM3 *iface, + IDirect3DRMVisual *visual, IDirect3DRMClippedVisual **clipped_visual) +{ + FIXME("iface %p, visual %p, clipped_visual %p stub!\n", iface, visual, clipped_visual); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_SetOptions(IDirect3DRM3 *iface, DWORD flags) +{ + FIXME("iface %p, flags %#lx stub!\n", iface, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm3_GetOptions(IDirect3DRM3 *iface, DWORD *flags) +{ + FIXME("iface %p, flags %p stub!\n", iface, flags); + + return E_NOTIMPL; +} + +static const struct IDirect3DRM3Vtbl d3drm3_vtbl = +{ + d3drm3_QueryInterface, + d3drm3_AddRef, + d3drm3_Release, + d3drm3_CreateObject, + d3drm3_CreateFrame, + d3drm3_CreateMesh, + d3drm3_CreateMeshBuilder, + d3drm3_CreateFace, + d3drm3_CreateAnimation, + d3drm3_CreateAnimationSet, + d3drm3_CreateTexture, + d3drm3_CreateLight, + d3drm3_CreateLightRGB, + d3drm3_CreateMaterial, + d3drm3_CreateDevice, + d3drm3_CreateDeviceFromSurface, + d3drm3_CreateDeviceFromD3D, + d3drm3_CreateDeviceFromClipper, + d3drm3_CreateTextureFromSurface, + d3drm3_CreateShadow, + d3drm3_CreateViewport, + d3drm3_CreateWrap, + d3drm3_CreateUserVisual, + d3drm3_LoadTexture, + d3drm3_LoadTextureFromResource, + d3drm3_SetSearchPath, + d3drm3_AddSearchPath, + d3drm3_GetSearchPath, + d3drm3_SetDefaultTextureColors, + d3drm3_SetDefaultTextureShades, + d3drm3_GetDevices, + d3drm3_GetNamedObject, + d3drm3_EnumerateObjects, + d3drm3_Load, + d3drm3_Tick, + d3drm3_CreateProgressiveMesh, + d3drm3_RegisterClient, + d3drm3_UnregisterClient, + d3drm3_CreateClippedVisual, + d3drm3_SetOptions, + d3drm3_GetOptions, +}; + +HRESULT WINAPI Direct3DRMCreate(IDirect3DRM **d3drm) +{ + struct d3drm *object; + + TRACE("d3drm %p.\n", d3drm); + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IDirect3DRM_iface.lpVtbl = &d3drm1_vtbl; + object->IDirect3DRM2_iface.lpVtbl = &d3drm2_vtbl; + object->IDirect3DRM3_iface.lpVtbl = &d3drm3_vtbl; + object->ref1 = 1; + object->iface_count = 1; + + *d3drm = &object->IDirect3DRM_iface; + + return S_OK; +} + +HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv) +{ + TRACE("(%s, %s, %p): stub\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); + + if(!ppv) + return E_INVALIDARG; + + return CLASS_E_CLASSNOTAVAILABLE; +} diff --git a/3rdparty/d3drm/d3drm.def b/3rdparty/d3drm/d3drm.def new file mode 100644 index 00000000..ae143f3e --- /dev/null +++ b/3rdparty/d3drm/d3drm.def @@ -0,0 +1,22 @@ +EXPORTS + D3DRMColorGetAlpha@4 + D3DRMColorGetBlue@4 + D3DRMColorGetGreen@4 + D3DRMColorGetRed@4 + D3DRMCreateColorRGB@12 + D3DRMCreateColorRGBA@16 + D3DRMMatrixFromQuaternion@8 + D3DRMQuaternionFromRotation@12 + D3DRMQuaternionMultiply@12 + D3DRMQuaternionSlerp@16 + D3DRMVectorAdd@12 + D3DRMVectorCrossProduct@12 + D3DRMVectorDotProduct@8 + D3DRMVectorModulus@4 + D3DRMVectorNormalize@4 + D3DRMVectorRandom@4 + D3DRMVectorReflect@12 + D3DRMVectorRotate@16 + D3DRMVectorScale@12 + D3DRMVectorSubtract@12 + Direct3DRMCreate@4 diff --git a/3rdparty/d3drm/d3drm.spec b/3rdparty/d3drm/d3drm.spec new file mode 100644 index 00000000..2c7a1a90 --- /dev/null +++ b/3rdparty/d3drm/d3drm.spec @@ -0,0 +1,23 @@ +@ stdcall D3DRMColorGetAlpha(long) +@ stdcall D3DRMColorGetBlue(long) +@ stdcall D3DRMColorGetGreen(long) +@ stdcall D3DRMColorGetRed(long) +@ stdcall D3DRMCreateColorRGB(float float float) +@ stdcall D3DRMCreateColorRGBA(float float float float) +@ stdcall D3DRMMatrixFromQuaternion(ptr ptr) +@ stdcall D3DRMQuaternionFromRotation(ptr ptr float) +@ stdcall D3DRMQuaternionMultiply(ptr ptr ptr) +@ stdcall D3DRMQuaternionSlerp(ptr ptr ptr float) +@ stdcall D3DRMVectorAdd(ptr ptr ptr) +@ stdcall D3DRMVectorCrossProduct(ptr ptr ptr) +@ stdcall D3DRMVectorDotProduct(ptr ptr) +@ stdcall D3DRMVectorModulus(ptr) +@ stdcall D3DRMVectorNormalize(ptr) +@ stdcall D3DRMVectorRandom(ptr) +@ stdcall D3DRMVectorReflect(ptr ptr ptr) +@ stdcall D3DRMVectorRotate(ptr ptr ptr float) +@ stdcall D3DRMVectorScale(ptr ptr float) +@ stdcall D3DRMVectorSubtract(ptr ptr ptr) +@ stdcall Direct3DRMCreate(ptr) +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) diff --git a/3rdparty/d3drm/d3drm_main.c b/3rdparty/d3drm/d3drm_main.c new file mode 100644 index 00000000..ff74704d --- /dev/null +++ b/3rdparty/d3drm/d3drm_main.c @@ -0,0 +1,150 @@ +/* + * Copyright 2004 Ivan Leo Puoti + * 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 + */ + +#include "initguid.h" +#include "d3drm_private.h" + +void d3drm_object_init(struct d3drm_object *object, const char *classname) +{ + object->ref = 1; + object->appdata = 0; + list_init(&object->destroy_callbacks); + object->classname = classname; + object->name = NULL; +} + +struct destroy_callback +{ + struct list entry; + D3DRMOBJECTCALLBACK cb; + void *ctx; +}; + +HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct destroy_callback *callback; + + if (!cb) + return D3DRMERR_BADVALUE; + + if (!(callback = malloc(sizeof(*callback)))) + return E_OUTOFMEMORY; + + callback->cb = cb; + callback->ctx = ctx; + + list_add_head(&object->destroy_callbacks, &callback->entry); + return D3DRM_OK; +} + +HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct destroy_callback *callback; + + if (!cb) + return D3DRMERR_BADVALUE; + + LIST_FOR_EACH_ENTRY(callback, &object->destroy_callbacks, struct destroy_callback, entry) + { + if (callback->cb == cb && callback->ctx == ctx) + { + list_remove(&callback->entry); + free(callback); + break; + } + } + + return D3DRM_OK; +} + +HRESULT d3drm_object_get_class_name(struct d3drm_object *object, DWORD *size, char *name) +{ + DWORD req_size; + + if (!size) + return E_INVALIDARG; + + req_size = strlen(object->classname) + 1; + if (name && *size < req_size) + return E_INVALIDARG; + + *size = req_size; + + if (name) + memcpy(name, object->classname, req_size); + + return D3DRM_OK; +} + +HRESULT d3drm_object_get_name(struct d3drm_object *object, DWORD *size, char *name) +{ + DWORD req_size; + + if (!size) + return E_INVALIDARG; + + req_size = object->name ? strlen(object->name) + 1 : 0; + if (name && *size < req_size) + return E_INVALIDARG; + + if (name) + { + if (object->name) + memcpy(name, object->name, req_size); + else if (*size) + *name = 0; + } + + *size = req_size; + + return D3DRM_OK; +} + +HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name) +{ + DWORD req_size; + + free(object->name); + object->name = NULL; + + if (name) + { + req_size = strlen(name) + 1; + if (!(object->name = malloc(req_size))) + return E_OUTOFMEMORY; + memcpy(object->name, name, req_size); + } + + return D3DRM_OK; +} + +void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object) +{ + struct destroy_callback *callback, *callback2; + + LIST_FOR_EACH_ENTRY_SAFE(callback, callback2, &object->destroy_callbacks, struct destroy_callback, entry) + { + callback->cb(iface, callback->ctx); + list_remove(&callback->entry); + free(callback); + } + + free(object->name); + object->name = NULL; +} diff --git a/3rdparty/d3drm/d3drm_private.h b/3rdparty/d3drm/d3drm_private.h new file mode 100644 index 00000000..e07efa1c --- /dev/null +++ b/3rdparty/d3drm/d3drm_private.h @@ -0,0 +1,333 @@ +/* + * 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__ + +#define COBJMACROS +#include +#include +#include "dxfile.h" +#include "d3drmwin.h" +#include "rmxfguid.h" +#include "wine/debug.h" +#include "wine/list.h" + +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; +} + +struct d3drm_object +{ + LONG ref; + DWORD appdata; + struct list destroy_callbacks; + const char *classname; + char *name; +}; + +struct d3drm_texture +{ + struct d3drm_object obj; + IDirect3DRMTexture IDirect3DRMTexture_iface; + IDirect3DRMTexture2 IDirect3DRMTexture2_iface; + IDirect3DRMTexture3 IDirect3DRMTexture3_iface; + IDirect3DRM *d3drm; + D3DRMIMAGE *image; + IDirectDrawSurface *surface; + LONG decal_x; + LONG decal_y; + DWORD max_colors; + DWORD max_shades; + BOOL transparency; + D3DVALUE decal_width; + D3DVALUE decal_height; +}; + +struct d3drm_frame +{ + struct d3drm_object obj; + IDirect3DRMFrame IDirect3DRMFrame_iface; + IDirect3DRMFrame2 IDirect3DRMFrame2_iface; + IDirect3DRMFrame3 IDirect3DRMFrame3_iface; + IDirect3DRM *d3drm; + LONG ref; + struct d3drm_frame *parent; + SIZE_T nb_children; + SIZE_T children_size; + IDirect3DRMFrame3 **children; + SIZE_T nb_visuals; + SIZE_T visuals_size; + IDirect3DRMVisual **visuals; + SIZE_T nb_lights; + SIZE_T lights_size; + IDirect3DRMLight **lights; + struct d3drm_matrix transform; + D3DCOLOR scenebackground; + DWORD traversal_options; +}; + +struct d3drm_box +{ + float left; + float top; + float right; + float bottom; + float front; + float back; +}; + +struct d3drm_viewport +{ + struct d3drm_object obj; + struct d3drm_device *device; + IDirect3DRMFrame *camera; + IDirect3DRMViewport IDirect3DRMViewport_iface; + IDirect3DRMViewport2 IDirect3DRMViewport2_iface; + IDirect3DViewport *d3d_viewport; + IDirect3DMaterial *material; + IDirect3DRM *d3drm; + struct d3drm_box clip; + D3DRMPROJECTIONTYPE projection; +}; + +struct d3drm_device +{ + struct d3drm_object obj; + 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; +}; + +struct d3drm_face +{ + struct d3drm_object obj; + IDirect3DRMFace IDirect3DRMFace_iface; + IDirect3DRMFace2 IDirect3DRMFace2_iface; + LONG ref; + D3DCOLOR color; +}; + +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; + D3DRMRENDERQUALITY quality; +}; + +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; + SIZE_T nb_groups; + SIZE_T groups_size; + struct mesh_group *groups; +}; + +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; +}; + +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; +}; + +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; +}; + +struct d3drm_animation +{ + struct d3drm_object obj; + IDirect3DRMAnimation2 IDirect3DRMAnimation2_iface; + IDirect3DRMAnimation IDirect3DRMAnimation_iface; + LONG ref; + IDirect3DRM *d3drm; + IDirect3DRMFrame3 *frame; + D3DRMANIMATIONOPTIONS options; + struct d3drm_animation_keys position; + struct d3drm_animation_keys scale; + struct d3drm_animation_keys rotate; +}; + +struct d3drm_wrap +{ + struct d3drm_object obj; + IDirect3DRMWrap IDirect3DRMWrap_iface; + LONG ref; +}; + +HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm); +HRESULT d3drm_device_create_surfaces_from_clipper(struct d3drm_device *object, IDirectDraw *ddraw, + IDirectDrawClipper *clipper, int width, int height, IDirectDrawSurface **surface); +void d3drm_device_destroy(struct d3drm_device *device); +HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw *ddraw, + IDirectDrawSurface *surface, BOOL create_z_surface); + +void d3drm_object_init(struct d3drm_object *object, const char *classname); +HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx); +HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx); +HRESULT d3drm_object_get_class_name(struct d3drm_object *object, DWORD *size, char *name); +HRESULT d3drm_object_get_name(struct d3drm_object *object, DWORD *size, char *name); +HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name); +void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object); + +struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame(IDirect3DRMFrame *iface); +struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface); + +struct d3drm_device *unsafe_impl_from_IDirect3DRMDevice3(IDirect3DRMDevice3 *iface); + +HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm); +HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, IDirect3DRM *d3drm); +HRESULT d3drm_face_create(struct d3drm_face **face); +HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3drm); +HRESULT d3drm_mesh_builder_create(struct d3drm_mesh_builder **mesh_builder, IDirect3DRM *d3drm); +HRESULT d3drm_light_create(struct d3drm_light **light, IDirect3DRM *d3drm); +HRESULT d3drm_material_create(struct d3drm_material **material, IDirect3DRM *d3drm); +HRESULT d3drm_mesh_create(struct d3drm_mesh **mesh, IDirect3DRM *d3drm); +HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *d3drm); +HRESULT d3drm_wrap_create(struct d3drm_wrap **wrap, IDirect3DRM *d3drm); + +HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *data, + D3DRMLOADTEXTURECALLBACK load_texture_proc, void *arg); + +struct d3drm_file_header +{ + WORD major; + WORD minor; + DWORD flags; +}; + +extern char templates[]; + +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)); +} + +BOOL d3drm_array_reserve(void **elements, SIZE_T *capacity, SIZE_T element_count, SIZE_T element_size); + +#endif /* __D3DRM_PRIVATE_INCLUDED__ */ diff --git a/3rdparty/d3drm/d3drmwin.h b/3rdparty/d3drm/d3drmwin.h new file mode 100644 index 00000000..bd3a40d8 --- /dev/null +++ b/3rdparty/d3drm/d3drmwin.h @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2010 Vijay Kiran Kamuju + * + * 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 __D3DRMWIN_H__ +#define __D3DRMWIN_H__ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************************************************************** + * Direct3DRMWinDevice interface GUID + */ + +DEFINE_GUID(IID_IDirect3DRMWinDevice, 0xc5016cc0, 0xd273, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); + +typedef struct IDirect3DRMWinDevice *LPDIRECT3DRMWINDEVICE, **LPLPDIRECT3DRMWINDEVICE; + +/***************************************************************************** + * IDirect3DRMWinDevice interface + */ +#define INTERFACE IDirect3DRMWinDevice +DECLARE_INTERFACE_(IDirect3DRMWinDevice,IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMWinDevice methods ***/ + STDMETHOD(HandlePaint)(THIS_ HDC) PURE; + STDMETHOD(HandleActivate)(THIS_ WORD) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMWinDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMWinDevice_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMWinDevice_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMWinDevice_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMWinDevice_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMWinDevice_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMWinDevice_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMWinDevice_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMWinDevice_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMWinDevice_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMWinDevice_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMWinDevice methods ***/ +#define IDirect3DRMWinDevice_HandlePaint(p,a) (p)->lpVtbl->HandlePaint(p,a) +#define IDirect3DRMWinDevice_HandleActivate(p,a) (p)->lpVtbl->HandleActivate(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMWinDevice_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMWinDevice_AddRef(p) (p)->AddRef() +#define IDirect3DRMwinDevice_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMWinDevice_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMWinDevice_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMWinDevice_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMWinDevice_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMWinDevice_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMWinDevice_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMWinDevice_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMWinDevice_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMWinDevice methods ***/ +#define IDirect3DRMWinDevice_HandlePaint(p,a) (p)->HandlePaint(a) +#define IDirect3DRMWinDevice_HandleActivate(p,a) (p)->HandleActivate(a) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __D3DRMWIN_H__ */ diff --git a/3rdparty/d3drm/device.c b/3rdparty/d3drm/device.c new file mode 100644 index 00000000..1a433746 --- /dev/null +++ b/3rdparty/d3drm/device.c @@ -0,0 +1,1676 @@ +/* + * Implementation of IDirect3DRMDevice Interface + * + * Copyright 2011, 2012 André Hentschel + * + * 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 + */ + +#include "d3drm_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d3drm); + +static inline struct d3drm_device *impl_from_IDirect3DRMDevice(IDirect3DRMDevice *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMDevice_iface); +} + +static inline struct d3drm_device *impl_from_IDirect3DRMDevice2(IDirect3DRMDevice2 *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMDevice2_iface); +} + +static inline struct d3drm_device *impl_from_IDirect3DRMDevice3(IDirect3DRMDevice3 *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMDevice3_iface); +} + +void d3drm_device_destroy(struct d3drm_device *device) +{ + d3drm_object_cleanup((IDirect3DRMObject *)&device->IDirect3DRMDevice_iface, &device->obj); + if (device->device) + { + TRACE("Releasing attached ddraw interfaces.\n"); + IDirect3DDevice_Release(device->device); + } + if (device->render_target) + IDirectDrawSurface_Release(device->render_target); + if (device->primary_surface) + { + TRACE("Releasing primary surface and attached clipper.\n"); + IDirectDrawSurface_Release(device->primary_surface); + IDirectDrawClipper_Release(device->clipper); + } + if (device->ddraw) + { + IDirectDraw_Release(device->ddraw); + IDirect3DRM_Release(device->d3drm); + } + free(device); +} + +static inline struct d3drm_device *impl_from_IDirect3DRMWinDevice(IDirect3DRMWinDevice *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMWinDevice_iface); +} + +HRESULT d3drm_device_create_surfaces_from_clipper(struct d3drm_device *object, IDirectDraw *ddraw, IDirectDrawClipper *clipper, int width, int height, IDirectDrawSurface **surface) +{ + DDSURFACEDESC surface_desc; + IDirectDrawSurface *primary_surface, *render_target; + HWND window; + HRESULT hr; + + hr = IDirectDrawClipper_GetHWnd(clipper, &window); + if (FAILED(hr)) + return hr; + + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + if (FAILED(hr)) + return hr; + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS; + surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &primary_surface, NULL); + if (FAILED(hr)) + return hr; + hr = IDirectDrawSurface_SetClipper(primary_surface, clipper); + if (FAILED(hr)) + { + IDirectDrawSurface_Release(primary_surface); + return hr; + } + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; + surface_desc.dwWidth = width; + surface_desc.dwHeight = height; + + hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &render_target, NULL); + if (FAILED(hr)) + { + IDirectDrawSurface_Release(primary_surface); + return hr; + } + + object->primary_surface = primary_surface; + object->clipper = clipper; + IDirectDrawClipper_AddRef(clipper); + *surface = render_target; + + return D3DRM_OK; +} + +HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw *ddraw, IDirectDrawSurface *surface, + BOOL create_z_surface) +{ + DDSCAPS caps = { DDSCAPS_ZBUFFER }; + IDirectDrawSurface *ds = NULL; + IDirect3DDevice *device1 = NULL; + IDirect3DDevice2 *device2 = NULL; + IDirect3DDevice3 *device3 = NULL; + IDirect3D2 *d3d2 = NULL; + IDirect3D3 *d3d3 = NULL; + DDSURFACEDESC desc, surface_desc; + HRESULT hr; + + device->ddraw = ddraw; + IDirectDraw_AddRef(ddraw); + IDirect3DRM_AddRef(device->d3drm); + device->render_target = surface; + IDirectDrawSurface_AddRef(surface); + + desc.dwSize = sizeof(desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &desc); + if (FAILED(hr)) + return hr; + + if (!(desc.ddsCaps.dwCaps & DDSCAPS_3DDEVICE)) + return DDERR_INVALIDCAPS; + + hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &ds); + if (SUCCEEDED(hr)) + { + create_z_surface = FALSE; + IDirectDrawSurface_Release(ds); + ds = NULL; + } + + if (create_z_surface) + { + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; + surface_desc.dwZBufferBitDepth = 16; + surface_desc.dwWidth = desc.dwWidth; + surface_desc.dwHeight = desc.dwHeight; + hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &ds, NULL); + if (FAILED(hr)) + return hr; + + hr = IDirectDrawSurface_AddAttachedSurface(surface, ds); + IDirectDrawSurface_Release(ds); + if (FAILED(hr)) + return hr; + } + + if (version == 1) + hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DRGBDevice, (void **)&device1); + else if (version == 2) + { + IDirectDraw_QueryInterface(ddraw, &IID_IDirect3D2, (void**)&d3d2); + hr = IDirect3D2_CreateDevice(d3d2, &IID_IDirect3DRGBDevice, surface, &device2); + IDirect3D2_Release(d3d2); + } + else + { + IDirectDrawSurface4 *surface4 = NULL; + + IDirectDrawSurface_QueryInterface(surface, &IID_IDirectDrawSurface4, (void**)&surface4); + IDirectDraw_QueryInterface(ddraw, &IID_IDirect3D3, (void**)&d3d3); + hr = IDirect3D3_CreateDevice(d3d3, &IID_IDirect3DRGBDevice, surface4, &device3, NULL); + IDirectDrawSurface4_Release(surface4); + IDirect3D3_Release(d3d3); + } + if (FAILED(hr)) + { + IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds); + return hr; + } + + if (version == 2) + { + hr = IDirect3DDevice2_QueryInterface(device2, &IID_IDirect3DDevice, (void**)&device1); + IDirect3DDevice2_Release(device2); + if (FAILED(hr)) + { + IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds); + return hr; + } + } + else if (version == 3) + { + hr = IDirect3DDevice3_QueryInterface(device3, &IID_IDirect3DDevice, (void**)&device1); + IDirect3DDevice3_Release(device3); + if (FAILED(hr)) + { + IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds); + return hr; + } + } + device->device = device1; + device->width = desc.dwWidth; + device->height = desc.dwHeight; + + return hr; +} + +static HRESULT d3drm_device_set_ddraw_device_d3d(struct d3drm_device *device, IDirect3D *d3d, IDirect3DDevice *d3d_device) +{ + IDirectDraw *ddraw; + IDirectDrawSurface *surface; + IDirect3DDevice2 *d3d_device2 = NULL; + DDSURFACEDESC desc; + HRESULT hr; + + /* AddRef these interfaces beforehand for the intentional leak on reinitialization. */ + if (FAILED(hr = IDirect3D_QueryInterface(d3d, &IID_IDirectDraw, (void **)&ddraw))) + return hr; + IDirect3DRM_AddRef(device->d3drm); + IDirect3DDevice_AddRef(d3d_device); + + /* Fetch render target and get width/height from there */ + if (FAILED(hr = IDirect3DDevice_QueryInterface(d3d_device, &IID_IDirectDrawSurface, (void **)&surface))) + { + if (FAILED(hr = IDirect3DDevice_QueryInterface(d3d_device, &IID_IDirect3DDevice2, (void **)&d3d_device2))) + return hr; + hr = IDirect3DDevice2_GetRenderTarget(d3d_device2, &surface); + IDirect3DDevice2_Release(d3d_device2); + if (FAILED(hr)) + return hr; + } + + if (device->ddraw) + { + if (d3d_device2) + IDirectDrawSurface_Release(surface); + return D3DRMERR_BADOBJECT; + } + + desc.dwSize = sizeof(desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &desc); + if (FAILED(hr)) + { + IDirectDrawSurface_Release(surface); + return hr; + } + + device->ddraw = ddraw; + device->width = desc.dwWidth; + device->height = desc.dwHeight; + device->device = d3d_device; + device->render_target = surface; + + return hr; +} + +static HRESULT WINAPI d3drm_device3_QueryInterface(IDirect3DRMDevice3 *iface, REFIID riid, void **out) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRMDevice) + || IsEqualGUID(riid, &IID_IDirect3DRMObject) + || IsEqualGUID(riid, &IID_IUnknown)) + { + *out = &device->IDirect3DRMDevice_iface; + } + else if (IsEqualGUID(riid, &IID_IDirect3DRMDevice2)) + { + *out = &device->IDirect3DRMDevice2_iface; + } + else if (IsEqualGUID(riid, &IID_IDirect3DRMDevice3)) + { + *out = &device->IDirect3DRMDevice3_iface; + } + else if (IsEqualGUID(riid, &IID_IDirect3DRMWinDevice)) + { + *out = &device->IDirect3DRMWinDevice_iface; + } + else + { + *out = NULL; + WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid)); + return CLASS_E_CLASSNOTAVAILABLE; + } + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} + +static HRESULT WINAPI d3drm_device2_QueryInterface(IDirect3DRMDevice2 *iface, REFIID riid, void **out) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + return d3drm_device3_QueryInterface(&device->IDirect3DRMDevice3_iface, riid, out); +} + +static HRESULT WINAPI d3drm_device1_QueryInterface(IDirect3DRMDevice *iface, REFIID riid, void **out) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + return d3drm_device3_QueryInterface(&device->IDirect3DRMDevice3_iface, riid, out); +} + +static ULONG WINAPI d3drm_device3_AddRef(IDirect3DRMDevice3 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + ULONG refcount = InterlockedIncrement(&device->obj.ref); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI d3drm_device2_AddRef(IDirect3DRMDevice2 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_AddRef(&device->IDirect3DRMDevice3_iface); +} + +static ULONG WINAPI d3drm_device1_AddRef(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_AddRef(&device->IDirect3DRMDevice3_iface); +} + +static ULONG WINAPI d3drm_device3_Release(IDirect3DRMDevice3 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + ULONG refcount = InterlockedDecrement(&device->obj.ref); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + d3drm_device_destroy(device); + + return refcount; +} + +static ULONG WINAPI d3drm_device2_Release(IDirect3DRMDevice2 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_Release(&device->IDirect3DRMDevice3_iface); +} + +static ULONG WINAPI d3drm_device1_Release(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_Release(&device->IDirect3DRMDevice3_iface); +} + +static HRESULT WINAPI d3drm_device3_Clone(IDirect3DRMDevice3 *iface, + IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device2_Clone(IDirect3DRMDevice2 *iface, + IUnknown *outer, REFIID iid, void **out) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, outer %p, iid %s, out %p\n", iface, outer, debugstr_guid(iid), out); + + return d3drm_device3_Clone(&device->IDirect3DRMDevice3_iface, outer, iid, out); +} + +static HRESULT WINAPI d3drm_device1_Clone(IDirect3DRMDevice *iface, + IUnknown *outer, REFIID iid, void **out) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out); + + return d3drm_device3_Clone(&device->IDirect3DRMDevice3_iface, outer, iid, out); +} + +static HRESULT WINAPI d3drm_device3_AddDestroyCallback(IDirect3DRMDevice3 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_add_destroy_callback(&device->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_device2_AddDestroyCallback(IDirect3DRMDevice2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_device3_AddDestroyCallback(&device->IDirect3DRMDevice3_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_device1_AddDestroyCallback(IDirect3DRMDevice *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_device3_AddDestroyCallback(&device->IDirect3DRMDevice3_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_device3_DeleteDestroyCallback(IDirect3DRMDevice3 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_delete_destroy_callback(&device->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_device2_DeleteDestroyCallback(IDirect3DRMDevice2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_device3_DeleteDestroyCallback(&device->IDirect3DRMDevice3_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_device1_DeleteDestroyCallback(IDirect3DRMDevice *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_device3_DeleteDestroyCallback(&device->IDirect3DRMDevice3_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_device3_SetAppData(IDirect3DRMDevice3 *iface, DWORD data) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + device->obj.appdata = data; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_device2_SetAppData(IDirect3DRMDevice2 *iface, DWORD data) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + return d3drm_device3_SetAppData(&device->IDirect3DRMDevice3_iface, data); +} + +static HRESULT WINAPI d3drm_device1_SetAppData(IDirect3DRMDevice *iface, DWORD data) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + return d3drm_device3_SetAppData(&device->IDirect3DRMDevice3_iface, data); +} + +static DWORD WINAPI d3drm_device3_GetAppData(IDirect3DRMDevice3 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p.\n", iface); + + return device->obj.appdata; +} + +static DWORD WINAPI d3drm_device2_GetAppData(IDirect3DRMDevice2 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetAppData(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device1_GetAppData(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetAppData(&device->IDirect3DRMDevice3_iface); +} + +static HRESULT WINAPI d3drm_device3_SetName(IDirect3DRMDevice3 *iface, const char *name) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_object_set_name(&device->obj, name); +} + +static HRESULT WINAPI d3drm_device2_SetName(IDirect3DRMDevice2 *iface, const char *name) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_device3_SetName(&device->IDirect3DRMDevice3_iface, name); +} + +static HRESULT WINAPI d3drm_device1_SetName(IDirect3DRMDevice *iface, const char *name) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_device3_SetName(&device->IDirect3DRMDevice3_iface, name); +} + +static HRESULT WINAPI d3drm_device3_GetName(IDirect3DRMDevice3 *iface, DWORD *size, char *name) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_name(&device->obj, size, name); +} + +static HRESULT WINAPI d3drm_device2_GetName(IDirect3DRMDevice2 *iface, DWORD *size, char *name) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_device3_GetName(&device->IDirect3DRMDevice3_iface, size, name); +} + +static HRESULT WINAPI d3drm_device1_GetName(IDirect3DRMDevice *iface, DWORD *size, char *name) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_device3_GetName(&device->IDirect3DRMDevice3_iface, size, name); +} + +static HRESULT WINAPI d3drm_device3_GetClassName(IDirect3DRMDevice3 *iface, DWORD *size, char *name) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_class_name(&device->obj, size, name); +} + +static HRESULT WINAPI d3drm_device2_GetClassName(IDirect3DRMDevice2 *iface, DWORD *size, char *name) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_device3_GetClassName(&device->IDirect3DRMDevice3_iface, size, name); +} + +static HRESULT WINAPI d3drm_device1_GetClassName(IDirect3DRMDevice *iface, DWORD *size, char *name) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_device3_GetClassName(&device->IDirect3DRMDevice3_iface, size, name); +} + +static HRESULT WINAPI d3drm_device3_Init(IDirect3DRMDevice3 *iface, ULONG width, ULONG height) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + FIXME("iface %p, width %lu, height %lu stub!\n", iface, width, height); + + device->height = height; + device->width = width; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_device2_Init(IDirect3DRMDevice2 *iface, ULONG width, ULONG height) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, width %lu, height %lu.\n", iface, width, height); + + return d3drm_device3_Init(&device->IDirect3DRMDevice3_iface, width, height); +} + +static HRESULT WINAPI d3drm_device1_Init(IDirect3DRMDevice *iface, ULONG width, ULONG height) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, width %lu, height %lu.\n", iface, width, height); + + return d3drm_device3_Init(&device->IDirect3DRMDevice3_iface, width, height); +} + +static HRESULT WINAPI d3drm_device3_InitFromD3D(IDirect3DRMDevice3 *iface, + IDirect3D *d3d, IDirect3DDevice *d3d_device) +{ + FIXME("iface %p, d3d %p, d3d_device %p stub!\n", iface, d3d, d3d_device); + + if (!d3d || !d3d_device) + return D3DRMERR_BADVALUE; + + return E_NOINTERFACE; +} + +static HRESULT WINAPI d3drm_device2_InitFromD3D(IDirect3DRMDevice2 *iface, + IDirect3D *d3d, IDirect3DDevice *d3d_device) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, d3d %p, d3d_device %p.\n", iface, d3d, d3d_device); + + return d3drm_device3_InitFromD3D(&device->IDirect3DRMDevice3_iface, d3d, d3d_device); +} + +static HRESULT WINAPI d3drm_device1_InitFromD3D(IDirect3DRMDevice *iface, + IDirect3D *d3d, IDirect3DDevice *d3d_device) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, d3d %p, d3d_device %p.\n", iface, d3d, d3d_device); + + if (!d3d || !d3d_device) + return D3DRMERR_BADVALUE; + + return d3drm_device_set_ddraw_device_d3d(device, d3d, d3d_device); +} + +static HRESULT WINAPI d3drm_device3_InitFromClipper(IDirect3DRMDevice3 *iface, + IDirectDrawClipper *clipper, GUID *guid, int width, int height) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + FIXME("iface %p, clipper %p, guid %s, width %d, height %d stub!\n", + iface, clipper, debugstr_guid(guid), width, height); + + device->height = height; + device->width = width; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_device2_InitFromClipper(IDirect3DRMDevice2 *iface, + IDirectDrawClipper *clipper, GUID *guid, int width, int height) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, clipper %p, guid %s, width %d, height %d.\n", + iface, clipper, debugstr_guid(guid), width, height); + + return d3drm_device3_InitFromClipper(&device->IDirect3DRMDevice3_iface, + clipper, guid, width, height); +} + +static HRESULT WINAPI d3drm_device1_InitFromClipper(IDirect3DRMDevice *iface, + IDirectDrawClipper *clipper, GUID *guid, int width, int height) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, clipper %p, guid %s, width %d, height %d.\n", + iface, clipper, debugstr_guid(guid), width, height); + + return d3drm_device3_InitFromClipper(&device->IDirect3DRMDevice3_iface, + clipper, guid, width, height); +} + +static HRESULT WINAPI d3drm_device3_Update(IDirect3DRMDevice3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_device2_Update(IDirect3DRMDevice2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_device1_Update(IDirect3DRMDevice *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_device3_AddUpdateCallback(IDirect3DRMDevice3 *iface, + D3DRMUPDATECALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device2_AddUpdateCallback(IDirect3DRMDevice2 *iface, + D3DRMUPDATECALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device1_AddUpdateCallback(IDirect3DRMDevice *iface, + D3DRMUPDATECALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device3_DeleteUpdateCallback(IDirect3DRMDevice3 *iface, + D3DRMUPDATECALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device2_DeleteUpdateCallback(IDirect3DRMDevice2 *iface, + D3DRMUPDATECALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device1_DeleteUpdateCallback(IDirect3DRMDevice *iface, + D3DRMUPDATECALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device3_SetBufferCount(IDirect3DRMDevice3 *iface, DWORD count) +{ + FIXME("iface %p, count %lu stub!\n", iface, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device2_SetBufferCount(IDirect3DRMDevice2 *iface, DWORD count) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, count %lu.\n", iface, count); + + return d3drm_device3_SetBufferCount(&device->IDirect3DRMDevice3_iface, count); +} + +static HRESULT WINAPI d3drm_device1_SetBufferCount(IDirect3DRMDevice *iface, DWORD count) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, count %lu.\n", iface, count); + + return d3drm_device3_SetBufferCount(&device->IDirect3DRMDevice3_iface, count); +} + +static DWORD WINAPI d3drm_device3_GetBufferCount(IDirect3DRMDevice3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static DWORD WINAPI d3drm_device2_GetBufferCount(IDirect3DRMDevice2 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetBufferCount(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device1_GetBufferCount(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetBufferCount(&device->IDirect3DRMDevice3_iface); +} + +static HRESULT WINAPI d3drm_device3_SetDither(IDirect3DRMDevice3 *iface, BOOL enable) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p, enable %#x.\n", iface, enable); + + device->dither = enable; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_device2_SetDither(IDirect3DRMDevice2 *iface, BOOL enable) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, enabled %#x.\n", iface, enable); + + return d3drm_device3_SetDither(&device->IDirect3DRMDevice3_iface, enable); +} + +static HRESULT WINAPI d3drm_device1_SetDither(IDirect3DRMDevice *iface, BOOL enable) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, enabled %#x.\n", iface, enable); + + return d3drm_device3_SetDither(&device->IDirect3DRMDevice3_iface, enable); +} + +static HRESULT WINAPI d3drm_device3_SetShades(IDirect3DRMDevice3 *iface, DWORD count) +{ + FIXME("iface %p, count %lu stub!\n", iface, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device2_SetShades(IDirect3DRMDevice2 *iface, DWORD count) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, count %lu.\n", iface, count); + + return d3drm_device3_SetShades(&device->IDirect3DRMDevice3_iface, count); +} + +static HRESULT WINAPI d3drm_device1_SetShades(IDirect3DRMDevice *iface, DWORD count) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, count %lu.\n", iface, count); + + return d3drm_device3_SetShades(&device->IDirect3DRMDevice3_iface, count); +} + +static HRESULT WINAPI d3drm_device3_SetQuality(IDirect3DRMDevice3 *iface, D3DRMRENDERQUALITY quality) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p, quality %lu.\n", iface, quality); + + device->quality = quality; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_device2_SetQuality(IDirect3DRMDevice2 *iface, D3DRMRENDERQUALITY quality) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, quality %lu.\n", iface, quality); + + return d3drm_device3_SetQuality(&device->IDirect3DRMDevice3_iface, quality); +} + +static HRESULT WINAPI d3drm_device1_SetQuality(IDirect3DRMDevice *iface, D3DRMRENDERQUALITY quality) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, quality %lu.\n", iface, quality); + + return d3drm_device3_SetQuality(&device->IDirect3DRMDevice3_iface, quality); +} + +static HRESULT WINAPI d3drm_device3_SetTextureQuality(IDirect3DRMDevice3 *iface, D3DRMTEXTUREQUALITY quality) +{ + FIXME("iface %p, quality %u stub!\n", iface, quality); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device2_SetTextureQuality(IDirect3DRMDevice2 *iface, D3DRMTEXTUREQUALITY quality) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, quality %u.\n", iface, quality); + + return d3drm_device3_SetTextureQuality(&device->IDirect3DRMDevice3_iface, quality); +} + +static HRESULT WINAPI d3drm_device1_SetTextureQuality(IDirect3DRMDevice *iface, D3DRMTEXTUREQUALITY quality) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, quality %u.\n", iface, quality); + + return d3drm_device3_SetTextureQuality(&device->IDirect3DRMDevice3_iface, quality); +} + +static HRESULT WINAPI d3drm_device3_GetViewports(IDirect3DRMDevice3 *iface, IDirect3DRMViewportArray **array) +{ + FIXME("iface %p, array %p stub!\n", iface, array); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device2_GetViewports(IDirect3DRMDevice2 *iface, IDirect3DRMViewportArray **array) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, array %p.\n", iface, array); + + return d3drm_device3_GetViewports(&device->IDirect3DRMDevice3_iface, array); +} + +static HRESULT WINAPI d3drm_device1_GetViewports(IDirect3DRMDevice *iface, IDirect3DRMViewportArray **array) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, array %p.\n", iface, array); + + return d3drm_device3_GetViewports(&device->IDirect3DRMDevice3_iface, array); +} + +static BOOL WINAPI d3drm_device3_GetDither(IDirect3DRMDevice3 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p.\n", iface); + + return device->dither; +} + +static BOOL WINAPI d3drm_device2_GetDither(IDirect3DRMDevice2 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetDither(&device->IDirect3DRMDevice3_iface); +} + +static BOOL WINAPI d3drm_device1_GetDither(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetDither(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device3_GetShades(IDirect3DRMDevice3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static DWORD WINAPI d3drm_device2_GetShades(IDirect3DRMDevice2 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetShades(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device1_GetShades(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetShades(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device3_GetHeight(IDirect3DRMDevice3 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p.\n", iface); + + return device->height; +} + +static DWORD WINAPI d3drm_device2_GetHeight(IDirect3DRMDevice2 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetHeight(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device1_GetHeight(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetHeight(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device3_GetWidth(IDirect3DRMDevice3 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p.\n", iface); + + return device->width; +} + +static DWORD WINAPI d3drm_device2_GetWidth(IDirect3DRMDevice2 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetWidth(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device1_GetWidth(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetWidth(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device3_GetTrianglesDrawn(IDirect3DRMDevice3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static DWORD WINAPI d3drm_device2_GetTrianglesDrawn(IDirect3DRMDevice2 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetTrianglesDrawn(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device1_GetTrianglesDrawn(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetTrianglesDrawn(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device3_GetWireframeOptions(IDirect3DRMDevice3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static DWORD WINAPI d3drm_device2_GetWireframeOptions(IDirect3DRMDevice2 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetWireframeOptions(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device1_GetWireframeOptions(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetWireframeOptions(&device->IDirect3DRMDevice3_iface); +} + +static D3DRMRENDERQUALITY WINAPI d3drm_device3_GetQuality(IDirect3DRMDevice3 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p.\n", iface); + + return device->quality; +} + +static D3DRMRENDERQUALITY WINAPI d3drm_device2_GetQuality(IDirect3DRMDevice2 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetQuality(&device->IDirect3DRMDevice3_iface); +} + +static D3DRMRENDERQUALITY WINAPI d3drm_device1_GetQuality(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetQuality(&device->IDirect3DRMDevice3_iface); +} + +static D3DCOLORMODEL WINAPI d3drm_device3_GetColorModel(IDirect3DRMDevice3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static D3DCOLORMODEL WINAPI d3drm_device2_GetColorModel(IDirect3DRMDevice2 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetColorModel(&device->IDirect3DRMDevice3_iface); +} + +static D3DCOLORMODEL WINAPI d3drm_device1_GetColorModel(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetColorModel(&device->IDirect3DRMDevice3_iface); +} + +static D3DRMTEXTUREQUALITY WINAPI d3drm_device3_GetTextureQuality(IDirect3DRMDevice3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static D3DRMTEXTUREQUALITY WINAPI d3drm_device2_GetTextureQuality(IDirect3DRMDevice2 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetTextureQuality(&device->IDirect3DRMDevice3_iface); +} + +static D3DRMTEXTUREQUALITY WINAPI d3drm_device1_GetTextureQuality(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetTextureQuality(&device->IDirect3DRMDevice3_iface); +} + +static HRESULT WINAPI d3drm_device3_GetDirect3DDevice(IDirect3DRMDevice3 *iface, IDirect3DDevice **d3d_device) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + TRACE("iface %p, d3d_device %p!\n", iface, d3d_device); + + *d3d_device = device->device; + IDirect3DDevice_AddRef(*d3d_device); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_device2_GetDirect3DDevice(IDirect3DRMDevice2 *iface, IDirect3DDevice **d3d_device) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, d3d_device %p.\n", iface, d3d_device); + + return d3drm_device3_GetDirect3DDevice(&device->IDirect3DRMDevice3_iface, d3d_device); +} + +static HRESULT WINAPI d3drm_device1_GetDirect3DDevice(IDirect3DRMDevice *iface, IDirect3DDevice **d3d_device) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, d3d_device %p.\n", iface, d3d_device); + + return d3drm_device3_GetDirect3DDevice(&device->IDirect3DRMDevice3_iface, d3d_device); +} + +static HRESULT WINAPI d3drm_device3_InitFromD3D2(IDirect3DRMDevice3 *iface, + IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + IDirect3D *d3d1; + IDirect3DDevice *d3d_device1; + HRESULT hr; + + TRACE("iface %p, d3d %p, d3d_device %p.\n", iface, d3d, d3d_device); + + if (!d3d || !d3d_device) + return D3DRMERR_BADVALUE; + + if (FAILED(hr = IDirect3D2_QueryInterface(d3d, &IID_IDirect3D, (void **)&d3d1))) + return hr; + if (FAILED(hr = IDirect3DDevice2_QueryInterface(d3d_device, &IID_IDirect3DDevice, (void **)&d3d_device1))) + { + IDirect3D_Release(d3d1); + return hr; + } + + hr = d3drm_device_set_ddraw_device_d3d(device, d3d1, d3d_device1); + IDirect3D_Release(d3d1); + IDirect3DDevice_Release(d3d_device1); + + return hr; +} + +static HRESULT WINAPI d3drm_device2_InitFromD3D2(IDirect3DRMDevice2 *iface, + IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, d3d %p, d3d_device %p.\n", iface, d3d, d3d_device); + + return d3drm_device3_InitFromD3D2(&device->IDirect3DRMDevice3_iface, d3d, d3d_device); +} + +static HRESULT WINAPI d3drm_device3_InitFromSurface(IDirect3DRMDevice3 *iface, + GUID *guid, IDirectDraw *ddraw, IDirectDrawSurface *backbuffer) +{ + FIXME("iface %p, guid %s, ddraw %p, backbuffer %p stub!\n", + iface, debugstr_guid(guid), ddraw, backbuffer); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device2_InitFromSurface(IDirect3DRMDevice2 *iface, + GUID *guid, IDirectDraw *ddraw, IDirectDrawSurface *backbuffer) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, guid %s, ddraw %p, backbuffer %p.\n", + iface, debugstr_guid(guid), ddraw, backbuffer); + + return d3drm_device3_InitFromSurface(&device->IDirect3DRMDevice3_iface, guid, ddraw, backbuffer); +} + +static HRESULT WINAPI d3drm_device3_SetRenderMode(IDirect3DRMDevice3 *iface, DWORD flags) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p, flags %#lx.\n", iface, flags); + + device->rendermode = flags; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_device2_SetRenderMode(IDirect3DRMDevice2 *iface, DWORD flags) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, flags %#lx.\n", iface, flags); + + return d3drm_device3_SetRenderMode(&device->IDirect3DRMDevice3_iface, flags); +} + +static DWORD WINAPI d3drm_device3_GetRenderMode(IDirect3DRMDevice3 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p.\n", iface); + + return device->rendermode; +} + +static DWORD WINAPI d3drm_device2_GetRenderMode(IDirect3DRMDevice2 *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetRenderMode(&device->IDirect3DRMDevice3_iface); +} + +static HRESULT WINAPI d3drm_device3_GetDirect3DDevice2(IDirect3DRMDevice3 *iface, IDirect3DDevice2 **d3d_device) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p, d3d_device %p.\n", iface, d3d_device); + + if (FAILED(IDirect3DDevice_QueryInterface(device->device, &IID_IDirect3DDevice2, (void**)d3d_device))) + return D3DRMERR_BADOBJECT; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_device2_GetDirect3DDevice2(IDirect3DRMDevice2 *iface, IDirect3DDevice2 **d3d_device) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, d3d_device %p.\n", iface, d3d_device); + + IDirect3DDevice_QueryInterface(device->device, &IID_IDirect3DDevice2, (void**)d3d_device); + + /* d3drm returns D3DRM_OK even if the call fails. */ + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_device3_FindPreferredTextureFormat(IDirect3DRMDevice3 *iface, + DWORD bitdepths, DWORD flags, DDPIXELFORMAT *pf) +{ + FIXME("iface %p, bitdepths %lu, flags %#lx, pf %p stub!\n", iface, bitdepths, flags, pf); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device3_RenderStateChange(IDirect3DRMDevice3 *iface, + D3DRENDERSTATETYPE state, DWORD value, DWORD flags) +{ + FIXME("iface %p, state %#x, value %#lx, flags %#lx stub!\n", iface, state, value, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device3_LightStateChange(IDirect3DRMDevice3 *iface, + D3DLIGHTSTATETYPE state, DWORD value, DWORD flags) +{ + FIXME("iface %p, state %#x, value %#lx, flags %#lx stub!\n", iface, state, value, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device3_GetStateChangeOptions(IDirect3DRMDevice3 *iface, + DWORD state_class, DWORD state_idx, DWORD *flags) +{ + FIXME("iface %p, state_class %#lx, state_idx %#lx, flags %p stub!\n", + iface, state_class, state_idx, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device3_SetStateChangeOptions(IDirect3DRMDevice3 *iface, + DWORD state_class, DWORD state_idx, DWORD flags) +{ + FIXME("iface %p, state_class %#lx, state_idx %#lx, flags %#lx stub!\n", + iface, state_class, state_idx, flags); + + return E_NOTIMPL; +} + +static const struct IDirect3DRMDevice3Vtbl d3drm_device3_vtbl = +{ + d3drm_device3_QueryInterface, + d3drm_device3_AddRef, + d3drm_device3_Release, + d3drm_device3_Clone, + d3drm_device3_AddDestroyCallback, + d3drm_device3_DeleteDestroyCallback, + d3drm_device3_SetAppData, + d3drm_device3_GetAppData, + d3drm_device3_SetName, + d3drm_device3_GetName, + d3drm_device3_GetClassName, + d3drm_device3_Init, + d3drm_device3_InitFromD3D, + d3drm_device3_InitFromClipper, + d3drm_device3_Update, + d3drm_device3_AddUpdateCallback, + d3drm_device3_DeleteUpdateCallback, + d3drm_device3_SetBufferCount, + d3drm_device3_GetBufferCount, + d3drm_device3_SetDither, + d3drm_device3_SetShades, + d3drm_device3_SetQuality, + d3drm_device3_SetTextureQuality, + d3drm_device3_GetViewports, + d3drm_device3_GetDither, + d3drm_device3_GetShades, + d3drm_device3_GetHeight, + d3drm_device3_GetWidth, + d3drm_device3_GetTrianglesDrawn, + d3drm_device3_GetWireframeOptions, + d3drm_device3_GetQuality, + d3drm_device3_GetColorModel, + d3drm_device3_GetTextureQuality, + d3drm_device3_GetDirect3DDevice, + d3drm_device3_InitFromD3D2, + d3drm_device3_InitFromSurface, + d3drm_device3_SetRenderMode, + d3drm_device3_GetRenderMode, + d3drm_device3_GetDirect3DDevice2, + d3drm_device3_FindPreferredTextureFormat, + d3drm_device3_RenderStateChange, + d3drm_device3_LightStateChange, + d3drm_device3_GetStateChangeOptions, + d3drm_device3_SetStateChangeOptions, +}; + +static const struct IDirect3DRMDevice2Vtbl d3drm_device2_vtbl = +{ + d3drm_device2_QueryInterface, + d3drm_device2_AddRef, + d3drm_device2_Release, + d3drm_device2_Clone, + d3drm_device2_AddDestroyCallback, + d3drm_device2_DeleteDestroyCallback, + d3drm_device2_SetAppData, + d3drm_device2_GetAppData, + d3drm_device2_SetName, + d3drm_device2_GetName, + d3drm_device2_GetClassName, + d3drm_device2_Init, + d3drm_device2_InitFromD3D, + d3drm_device2_InitFromClipper, + d3drm_device2_Update, + d3drm_device2_AddUpdateCallback, + d3drm_device2_DeleteUpdateCallback, + d3drm_device2_SetBufferCount, + d3drm_device2_GetBufferCount, + d3drm_device2_SetDither, + d3drm_device2_SetShades, + d3drm_device2_SetQuality, + d3drm_device2_SetTextureQuality, + d3drm_device2_GetViewports, + d3drm_device2_GetDither, + d3drm_device2_GetShades, + d3drm_device2_GetHeight, + d3drm_device2_GetWidth, + d3drm_device2_GetTrianglesDrawn, + d3drm_device2_GetWireframeOptions, + d3drm_device2_GetQuality, + d3drm_device2_GetColorModel, + d3drm_device2_GetTextureQuality, + d3drm_device2_GetDirect3DDevice, + d3drm_device2_InitFromD3D2, + d3drm_device2_InitFromSurface, + d3drm_device2_SetRenderMode, + d3drm_device2_GetRenderMode, + d3drm_device2_GetDirect3DDevice2, +}; + +static const struct IDirect3DRMDeviceVtbl d3drm_device1_vtbl = +{ + d3drm_device1_QueryInterface, + d3drm_device1_AddRef, + d3drm_device1_Release, + d3drm_device1_Clone, + d3drm_device1_AddDestroyCallback, + d3drm_device1_DeleteDestroyCallback, + d3drm_device1_SetAppData, + d3drm_device1_GetAppData, + d3drm_device1_SetName, + d3drm_device1_GetName, + d3drm_device1_GetClassName, + d3drm_device1_Init, + d3drm_device1_InitFromD3D, + d3drm_device1_InitFromClipper, + d3drm_device1_Update, + d3drm_device1_AddUpdateCallback, + d3drm_device1_DeleteUpdateCallback, + d3drm_device1_SetBufferCount, + d3drm_device1_GetBufferCount, + d3drm_device1_SetDither, + d3drm_device1_SetShades, + d3drm_device1_SetQuality, + d3drm_device1_SetTextureQuality, + d3drm_device1_GetViewports, + d3drm_device1_GetDither, + d3drm_device1_GetShades, + d3drm_device1_GetHeight, + d3drm_device1_GetWidth, + d3drm_device1_GetTrianglesDrawn, + d3drm_device1_GetWireframeOptions, + d3drm_device1_GetQuality, + d3drm_device1_GetColorModel, + d3drm_device1_GetTextureQuality, + d3drm_device1_GetDirect3DDevice, +}; + +static HRESULT WINAPI d3drm_device_win_QueryInterface(IDirect3DRMWinDevice *iface, REFIID riid, void **out) +{ + struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + return d3drm_device3_QueryInterface(&device->IDirect3DRMDevice3_iface, riid, out); +} + +static ULONG WINAPI d3drm_device_win_AddRef(IDirect3DRMWinDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_AddRef(&device->IDirect3DRMDevice3_iface); +} + +static ULONG WINAPI d3drm_device_win_Release(IDirect3DRMWinDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_Release(&device->IDirect3DRMDevice3_iface); +} + +static HRESULT WINAPI d3drm_device_win_Clone(IDirect3DRMWinDevice *iface, + IUnknown *outer, REFIID iid, void **out) +{ + struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); + + TRACE("iface %p, outer %p, iid %s, out %p\n", iface, outer, debugstr_guid(iid), out); + + return d3drm_device3_Clone(&device->IDirect3DRMDevice3_iface, outer, iid, out); +} + +static HRESULT WINAPI d3drm_device_win_AddDestroyCallback(IDirect3DRMWinDevice *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device_win_DeleteDestroyCallback(IDirect3DRMWinDevice *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device_win_SetAppData(IDirect3DRMWinDevice *iface, DWORD data) +{ + struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + return d3drm_device3_SetAppData(&device->IDirect3DRMDevice3_iface, data); +} + +static DWORD WINAPI d3drm_device_win_GetAppData(IDirect3DRMWinDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_device3_GetAppData(&device->IDirect3DRMDevice3_iface); +} + +static HRESULT WINAPI d3drm_device_win_SetName(IDirect3DRMWinDevice *iface, const char *name) +{ + struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_device3_SetName(&device->IDirect3DRMDevice3_iface, name); +} + +static HRESULT WINAPI d3drm_device_win_GetName(IDirect3DRMWinDevice *iface, DWORD *size, char *name) +{ + struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_device3_GetName(&device->IDirect3DRMDevice3_iface, size, name); +} + +static HRESULT WINAPI d3drm_device_win_GetClassName(IDirect3DRMWinDevice *iface, DWORD *size, char *name) +{ + struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_device3_GetClassName(&device->IDirect3DRMDevice3_iface, size, name); +} + +static HRESULT WINAPI d3drm_device_win_HandlePaint(IDirect3DRMWinDevice *iface, HDC dc) +{ + FIXME("iface %p, dc %p stub!\n", iface, dc); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_device_win_HandleActivate(IDirect3DRMWinDevice *iface, WORD wparam) +{ + FIXME("iface %p, wparam %#x stub!\n", iface, wparam); + + return D3DRM_OK; +} + +static const struct IDirect3DRMWinDeviceVtbl d3drm_device_win_vtbl = +{ + d3drm_device_win_QueryInterface, + d3drm_device_win_AddRef, + d3drm_device_win_Release, + d3drm_device_win_Clone, + d3drm_device_win_AddDestroyCallback, + d3drm_device_win_DeleteDestroyCallback, + d3drm_device_win_SetAppData, + d3drm_device_win_GetAppData, + d3drm_device_win_SetName, + d3drm_device_win_GetName, + d3drm_device_win_GetClassName, + d3drm_device_win_HandlePaint, + d3drm_device_win_HandleActivate, +}; + +struct d3drm_device *unsafe_impl_from_IDirect3DRMDevice3(IDirect3DRMDevice3 *iface) +{ + if (!iface) + return NULL; + assert(iface->lpVtbl == &d3drm_device3_vtbl); + + return impl_from_IDirect3DRMDevice3(iface); +} + +HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm) +{ + static const char classname[] = "Device"; + struct d3drm_device *object; + + TRACE("device %p, d3drm %p.\n", device, d3drm); + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IDirect3DRMDevice_iface.lpVtbl = &d3drm_device1_vtbl; + object->IDirect3DRMDevice2_iface.lpVtbl = &d3drm_device2_vtbl; + object->IDirect3DRMDevice3_iface.lpVtbl = &d3drm_device3_vtbl; + object->IDirect3DRMWinDevice_iface.lpVtbl = &d3drm_device_win_vtbl; + object->d3drm = d3drm; + d3drm_object_init(&object->obj, classname); + + *device = object; + + return D3DRM_OK; +} diff --git a/3rdparty/d3drm/face.c b/3rdparty/d3drm/face.c new file mode 100644 index 00000000..34810894 --- /dev/null +++ b/3rdparty/d3drm/face.c @@ -0,0 +1,639 @@ +/* + * Implementation of IDirect3DRMFace Interface + * + * Copyright 2013 André Hentschel + * + * 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 + */ + +#include "d3drm_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d3drm); + +static inline struct d3drm_face *impl_from_IDirect3DRMFace(IDirect3DRMFace *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_face, IDirect3DRMFace_iface); +} + +static inline struct d3drm_face *impl_from_IDirect3DRMFace2(IDirect3DRMFace2 *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_face, IDirect3DRMFace2_iface); +} + +static HRESULT WINAPI d3drm_face1_QueryInterface(IDirect3DRMFace *iface, REFIID riid, void **out) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRMFace) + || IsEqualGUID(riid, &IID_IDirect3DRMObject) + || IsEqualGUID(riid, &IID_IUnknown)) + { + *out = &face->IDirect3DRMFace_iface; + } + else if(IsEqualGUID(riid, &IID_IDirect3DRMFace2)) + { + *out = &face->IDirect3DRMFace2_iface; + } + else + { + *out = NULL; + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} + +static ULONG WINAPI d3drm_face1_AddRef(IDirect3DRMFace *iface) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace(iface); + ULONG refcount = InterlockedIncrement(&face->ref); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI d3drm_face1_Release(IDirect3DRMFace *iface) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace(iface); + ULONG refcount = InterlockedDecrement(&face->ref); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + { + d3drm_object_cleanup((IDirect3DRMObject *)iface, &face->obj); + free(face); + } + + return refcount; +} + +static HRESULT WINAPI d3drm_face1_Clone(IDirect3DRMFace *iface, + IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face1_AddDestroyCallback(IDirect3DRMFace *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return IDirect3DRMFace2_AddDestroyCallback(&face->IDirect3DRMFace2_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_face1_DeleteDestroyCallback(IDirect3DRMFace *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return IDirect3DRMFace2_DeleteDestroyCallback(&face->IDirect3DRMFace2_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_face2_SetAppData(IDirect3DRMFace2 *iface, DWORD data) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + face->obj.appdata = data; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_face1_SetAppData(IDirect3DRMFace *iface, DWORD data) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + return d3drm_face2_SetAppData(&face->IDirect3DRMFace2_iface, data); +} + +static DWORD WINAPI d3drm_face2_GetAppData(IDirect3DRMFace2 *iface) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface); + + TRACE("iface %p.\n", iface); + + return face->obj.appdata; +} + +static DWORD WINAPI d3drm_face1_GetAppData(IDirect3DRMFace *iface) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_face2_GetAppData(&face->IDirect3DRMFace2_iface); +} + +static HRESULT WINAPI d3drm_face2_SetName(IDirect3DRMFace2 *iface, const char *name) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_object_set_name(&face->obj, name); +} + +static HRESULT WINAPI d3drm_face1_SetName(IDirect3DRMFace *iface, const char *name) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_face2_SetName(&face->IDirect3DRMFace2_iface, name); +} + +static HRESULT WINAPI d3drm_face2_GetName(IDirect3DRMFace2 *iface, DWORD *size, char *name) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_name(&face->obj, size, name); +} + +static HRESULT WINAPI d3drm_face1_GetName(IDirect3DRMFace *iface, DWORD *size, char *name) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_face2_GetName(&face->IDirect3DRMFace2_iface, size, name); +} + +static HRESULT WINAPI d3drm_face1_GetClassName(IDirect3DRMFace *iface, DWORD *size, char *name) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return IDirect3DRMFace2_GetClassName(&face->IDirect3DRMFace2_iface, size, name); +} + +static HRESULT WINAPI d3drm_face1_AddVertex(IDirect3DRMFace *iface, D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface, x, y, z); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face1_AddVertexAndNormalIndexed(IDirect3DRMFace *iface, + DWORD vertex, DWORD normal) +{ + FIXME("iface %p, vertex %lu, normal %lu stub!\n", iface, vertex, normal); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face2_SetColorRGB(IDirect3DRMFace2 *iface, D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface); + + TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue); + + d3drm_set_color(&face->color, red, green, blue, 1.0f); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_face1_SetColorRGB(IDirect3DRMFace *iface, + D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace(iface); + + TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue); + + return d3drm_face2_SetColorRGB(&face->IDirect3DRMFace2_iface, red, green, blue); +} + +static HRESULT WINAPI d3drm_face2_SetColor(IDirect3DRMFace2 *iface, D3DCOLOR color) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface); + + TRACE("iface %p, color 0x%08lx.\n", iface, color); + + face->color = color; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_face1_SetColor(IDirect3DRMFace *iface, D3DCOLOR color) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace(iface); + + TRACE("iface %p, color 0x%08lx.\n", iface, color); + + return d3drm_face2_SetColor(&face->IDirect3DRMFace2_iface, color); +} + +static HRESULT WINAPI d3drm_face1_SetTexture(IDirect3DRMFace *iface, IDirect3DRMTexture *texture) +{ + FIXME("iface %p, texture %p stub!\n", iface, texture); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face1_SetTextureCoordinates(IDirect3DRMFace *iface, + DWORD vertex, D3DVALUE u, D3DVALUE v) +{ + FIXME("iface %p, vertex %lu, u %.8e, v %.8e stub!\n", iface, vertex, u, v); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face1_SetMaterial(IDirect3DRMFace *iface, IDirect3DRMMaterial *material) +{ + FIXME("iface %p, material %p stub!\n", iface, material); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face1_SetTextureTopology(IDirect3DRMFace *iface, BOOL wrap_u, BOOL wrap_v) +{ + FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face1_GetVertex(IDirect3DRMFace *iface, + DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal) +{ + FIXME("iface %p, index %lu, vertex %p, normal %p stub!\n", iface, index, vertex, normal); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face1_GetVertices(IDirect3DRMFace *iface, + DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals) +{ + FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n", + iface, vertex_count, coords, normals); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face1_GetTextureCoordinates(IDirect3DRMFace *iface, + DWORD vertex, D3DVALUE *u, D3DVALUE *v) +{ + FIXME("iface %p, vertex %lu, u %p, v %p stub!\n", iface, vertex, u, v); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face1_GetTextureTopology(IDirect3DRMFace *iface, BOOL *wrap_u, BOOL *wrap_v) +{ + FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face1_GetNormal(IDirect3DRMFace *iface, D3DVECTOR *normal) +{ + FIXME("iface %p, normal %p stub!\n", iface, normal); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face1_GetTexture(IDirect3DRMFace *iface, IDirect3DRMTexture **texture) +{ + FIXME("iface %p, texture %p stub!\n", iface, texture); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face1_GetMaterial(IDirect3DRMFace *iface, IDirect3DRMMaterial **material) +{ + FIXME("iface %p, material %p stub!\n", iface, material); + + return E_NOTIMPL; +} + +static int WINAPI d3drm_face1_GetVertexCount(IDirect3DRMFace *iface) +{ + FIXME("iface %p stub!\n", iface); + + return 0; +} + +static int WINAPI d3drm_face1_GetVertexIndex(IDirect3DRMFace *iface, DWORD which) +{ + FIXME("iface %p, which %lu stub!\n", iface, which); + + return 0; +} + +static int WINAPI d3drm_face1_GetTextureCoordinateIndex(IDirect3DRMFace *iface, DWORD which) +{ + FIXME("iface %p, which %lu stub!\n", iface, which); + + return 0; +} + +static D3DCOLOR WINAPI d3drm_face2_GetColor(IDirect3DRMFace2 *iface) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface); + + TRACE("iface %p.\n", iface); + + return face->color; +} + +static D3DCOLOR WINAPI d3drm_face1_GetColor(IDirect3DRMFace *iface) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_face2_GetColor(&face->IDirect3DRMFace2_iface); +} + +static const struct IDirect3DRMFaceVtbl d3drm_face1_vtbl = +{ + d3drm_face1_QueryInterface, + d3drm_face1_AddRef, + d3drm_face1_Release, + d3drm_face1_Clone, + d3drm_face1_AddDestroyCallback, + d3drm_face1_DeleteDestroyCallback, + d3drm_face1_SetAppData, + d3drm_face1_GetAppData, + d3drm_face1_SetName, + d3drm_face1_GetName, + d3drm_face1_GetClassName, + d3drm_face1_AddVertex, + d3drm_face1_AddVertexAndNormalIndexed, + d3drm_face1_SetColorRGB, + d3drm_face1_SetColor, + d3drm_face1_SetTexture, + d3drm_face1_SetTextureCoordinates, + d3drm_face1_SetMaterial, + d3drm_face1_SetTextureTopology, + d3drm_face1_GetVertex, + d3drm_face1_GetVertices, + d3drm_face1_GetTextureCoordinates, + d3drm_face1_GetTextureTopology, + d3drm_face1_GetNormal, + d3drm_face1_GetTexture, + d3drm_face1_GetMaterial, + d3drm_face1_GetVertexCount, + d3drm_face1_GetVertexIndex, + d3drm_face1_GetTextureCoordinateIndex, + d3drm_face1_GetColor, +}; + +static HRESULT WINAPI d3drm_face2_QueryInterface(IDirect3DRMFace2 *iface, REFIID riid, void **out) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface); + + return d3drm_face1_QueryInterface(&face->IDirect3DRMFace_iface, riid, out); +} + +static ULONG WINAPI d3drm_face2_AddRef(IDirect3DRMFace2 *iface) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface); + + return d3drm_face1_AddRef(&face->IDirect3DRMFace_iface); +} + +static ULONG WINAPI d3drm_face2_Release(IDirect3DRMFace2 *iface) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface); + + return d3drm_face1_Release(&face->IDirect3DRMFace_iface); +} + +static HRESULT WINAPI d3drm_face2_Clone(IDirect3DRMFace2 *iface, + IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face2_AddDestroyCallback(IDirect3DRMFace2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_add_destroy_callback(&face->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_face2_DeleteDestroyCallback(IDirect3DRMFace2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_delete_destroy_callback(&face->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_face2_GetClassName(IDirect3DRMFace2 *iface, DWORD *size, char *name) +{ + struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_class_name(&face->obj, size, name); +} + +static HRESULT WINAPI d3drm_face2_AddVertex(IDirect3DRMFace2 *iface, D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + FIXME("iface %p, x %.8e, y %.8e, z %.8e stub!\n", iface, x, y, z); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face2_AddVertexAndNormalIndexed(IDirect3DRMFace2 *iface, + DWORD vertex, DWORD normal) +{ + FIXME("iface %p, vertex %lu, normal %lu stub!\n", iface, vertex, normal); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face2_SetTexture(IDirect3DRMFace2 *iface, IDirect3DRMTexture3 *texture) +{ + FIXME("iface %p, texture %p stub!\n", iface, texture); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face2_SetTextureCoordinates(IDirect3DRMFace2 *iface, + DWORD vertex, D3DVALUE u, D3DVALUE v) +{ + FIXME("iface %p, vertex %lu, u %.8e, v %.8e stub!\n", iface, vertex, u, v); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face2_SetMaterial(IDirect3DRMFace2 *iface, IDirect3DRMMaterial2 *material) +{ + FIXME("iface %p, material %p stub!\n", iface, material); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face2_SetTextureTopology(IDirect3DRMFace2 *iface, BOOL wrap_u, BOOL wrap_v) +{ + FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face2_GetVertex(IDirect3DRMFace2 *iface, + DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal) +{ + FIXME("iface %p, index %lu, vertex %p, normal %p stub!\n", iface, index, vertex, normal); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face2_GetVertices(IDirect3DRMFace2 *iface, + DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals) +{ + FIXME("iface %p, vertex_count %p, coords %p, normals %p stub!\n", + iface, vertex_count, coords, normals); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face2_GetTextureCoordinates(IDirect3DRMFace2 *iface, + DWORD vertex, D3DVALUE *u, D3DVALUE *v) +{ + FIXME("iface %p, vertex %lu, u %p, v %p stub!\n", iface, vertex, u, v); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face2_GetTextureTopology(IDirect3DRMFace2 *iface, BOOL *wrap_u, BOOL *wrap_v) +{ + FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face2_GetNormal(IDirect3DRMFace2 *iface, D3DVECTOR *normal) +{ + FIXME("iface %p, normal %p stub!\n", iface, normal); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face2_GetTexture(IDirect3DRMFace2 *iface, IDirect3DRMTexture3 **texture) +{ + FIXME("iface %p, texture %p stub!\n", iface, texture); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_face2_GetMaterial(IDirect3DRMFace2 *iface, IDirect3DRMMaterial2 **material) +{ + FIXME("iface %p, material %p stub!\n", iface, material); + + return E_NOTIMPL; +} + +static int WINAPI d3drm_face2_GetVertexCount(IDirect3DRMFace2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return 0; +} + +static int WINAPI d3drm_face2_GetVertexIndex(IDirect3DRMFace2 *iface, DWORD which) +{ + FIXME("iface %p, which %lu stub!\n", iface, which); + + return 0; +} + +static int WINAPI d3drm_face2_GetTextureCoordinateIndex(IDirect3DRMFace2 *iface, DWORD which) +{ + FIXME("iface %p, which %lu stub!\n", iface, which); + + return 0; +} + +static const struct IDirect3DRMFace2Vtbl d3drm_face2_vtbl = +{ + d3drm_face2_QueryInterface, + d3drm_face2_AddRef, + d3drm_face2_Release, + d3drm_face2_Clone, + d3drm_face2_AddDestroyCallback, + d3drm_face2_DeleteDestroyCallback, + d3drm_face2_SetAppData, + d3drm_face2_GetAppData, + d3drm_face2_SetName, + d3drm_face2_GetName, + d3drm_face2_GetClassName, + d3drm_face2_AddVertex, + d3drm_face2_AddVertexAndNormalIndexed, + d3drm_face2_SetColorRGB, + d3drm_face2_SetColor, + d3drm_face2_SetTexture, + d3drm_face2_SetTextureCoordinates, + d3drm_face2_SetMaterial, + d3drm_face2_SetTextureTopology, + d3drm_face2_GetVertex, + d3drm_face2_GetVertices, + d3drm_face2_GetTextureCoordinates, + d3drm_face2_GetTextureTopology, + d3drm_face2_GetNormal, + d3drm_face2_GetTexture, + d3drm_face2_GetMaterial, + d3drm_face2_GetVertexCount, + d3drm_face2_GetVertexIndex, + d3drm_face2_GetTextureCoordinateIndex, + d3drm_face2_GetColor, +}; + +HRESULT d3drm_face_create(struct d3drm_face **face) +{ + static const char classname[] = "Face"; + struct d3drm_face *object; + + TRACE("face %p.\n", face); + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IDirect3DRMFace_iface.lpVtbl = &d3drm_face1_vtbl; + object->IDirect3DRMFace2_iface.lpVtbl = &d3drm_face2_vtbl; + object->ref = 1; + + d3drm_object_init(&object->obj, classname); + + *face = object; + + return S_OK; +} diff --git a/3rdparty/d3drm/frame.c b/3rdparty/d3drm/frame.c new file mode 100644 index 00000000..7a5bd18c --- /dev/null +++ b/3rdparty/d3drm/frame.c @@ -0,0 +1,3905 @@ +/* + * Implementation of IDirect3DRMFrame Interface + * + * Copyright 2011, 2012 André Hentschel + * Copyright 2012 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 + */ + +#include "d3drm_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d3drm); + +static const struct d3drm_matrix identity = +{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, +}; + +struct d3drm_frame_array +{ + IDirect3DRMFrameArray IDirect3DRMFrameArray_iface; + LONG ref; + ULONG size; + IDirect3DRMFrame **frames; +}; + +struct d3drm_visual_array +{ + IDirect3DRMVisualArray IDirect3DRMVisualArray_iface; + LONG ref; + ULONG size; + IDirect3DRMVisual **visuals; +}; + +struct d3drm_light_array +{ + IDirect3DRMLightArray IDirect3DRMLightArray_iface; + LONG ref; + ULONG size; + IDirect3DRMLight **lights; +}; + +static inline struct d3drm_frame *impl_from_IDirect3DRMFrame(IDirect3DRMFrame *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_frame, IDirect3DRMFrame_iface); +} + +static inline struct d3drm_frame *impl_from_IDirect3DRMFrame2(IDirect3DRMFrame2 *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_frame, IDirect3DRMFrame2_iface); +} + +static inline struct d3drm_frame *impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_frame, IDirect3DRMFrame3_iface); +} + +static inline struct d3drm_frame_array *impl_from_IDirect3DRMFrameArray(IDirect3DRMFrameArray *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_frame_array, IDirect3DRMFrameArray_iface); +} + +static inline struct d3drm_visual_array *impl_from_IDirect3DRMVisualArray(IDirect3DRMVisualArray *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_visual_array, IDirect3DRMVisualArray_iface); +} + +static inline struct d3drm_light_array *impl_from_IDirect3DRMLightArray(IDirect3DRMLightArray *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_light_array, IDirect3DRMLightArray_iface); +} + +static inline struct d3drm_animation *impl_from_IDirect3DRMAnimation(IDirect3DRMAnimation *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_animation, IDirect3DRMAnimation_iface); +} + +static inline struct d3drm_animation *impl_from_IDirect3DRMAnimation2(IDirect3DRMAnimation2 *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_animation, IDirect3DRMAnimation2_iface); +} + +static void d3drm_matrix_multiply_affine(struct d3drm_matrix *dst, + const struct d3drm_matrix *src1, const struct d3drm_matrix *src2) +{ + struct d3drm_matrix tmp; + + tmp._11 = src1->_11 * src2->_11 + src1->_12 * src2->_21 + src1->_13 * src2->_31; + tmp._12 = src1->_11 * src2->_12 + src1->_12 * src2->_22 + src1->_13 * src2->_32; + tmp._13 = src1->_11 * src2->_13 + src1->_12 * src2->_23 + src1->_13 * src2->_33; + tmp._14 = 0.0f; + + tmp._21 = src1->_21 * src2->_11 + src1->_22 * src2->_21 + src1->_23 * src2->_31; + tmp._22 = src1->_21 * src2->_12 + src1->_22 * src2->_22 + src1->_23 * src2->_32; + tmp._23 = src1->_21 * src2->_13 + src1->_22 * src2->_23 + src1->_23 * src2->_33; + tmp._24 = 0.0f; + + tmp._31 = src1->_31 * src2->_11 + src1->_32 * src2->_21 + src1->_33 * src2->_31; + tmp._32 = src1->_31 * src2->_12 + src1->_32 * src2->_22 + src1->_33 * src2->_32; + tmp._33 = src1->_31 * src2->_13 + src1->_32 * src2->_23 + src1->_33 * src2->_33; + tmp._34 = 0.0f; + + tmp._41 = src1->_41 * src2->_11 + src1->_42 * src2->_21 + src1->_43 * src2->_31 + src2->_41; + tmp._42 = src1->_41 * src2->_12 + src1->_42 * src2->_22 + src1->_43 * src2->_32 + src2->_42; + tmp._43 = src1->_41 * src2->_13 + src1->_42 * src2->_23 + src1->_43 * src2->_33 + src2->_43; + tmp._44 = 1.0f; + + *dst = tmp; +} + +static void d3drm_matrix_set_rotation(struct d3drm_matrix *matrix, D3DVECTOR *axis, float theta) +{ + float sin_theta, cos_theta, vers_theta; + + D3DRMVectorNormalize(axis); + sin_theta = sinf(theta); + cos_theta = cosf(theta); + vers_theta = 1.0f - cos_theta; + + matrix->_11 = vers_theta * axis->x * axis->x + cos_theta; + matrix->_21 = vers_theta * axis->x * axis->y - sin_theta * axis->z; + matrix->_31 = vers_theta * axis->x * axis->z + sin_theta * axis->y; + matrix->_41 = 0.0f; + + matrix->_12 = vers_theta * axis->y * axis->x + sin_theta * axis->z; + matrix->_22 = vers_theta * axis->y * axis->y + cos_theta; + matrix->_32 = vers_theta * axis->y * axis->z - sin_theta * axis->x; + matrix->_42 = 0.0f; + + matrix->_13 = vers_theta * axis->z * axis->x - sin_theta * axis->y; + matrix->_23 = vers_theta * axis->z * axis->y + sin_theta * axis->x; + matrix->_33 = vers_theta * axis->z * axis->z + cos_theta; + matrix->_43 = 0.0f; + + matrix->_14 = 0.0f; + matrix->_24 = 0.0f; + matrix->_34 = 0.0f; + matrix->_44 = 1.0f; +} + +static void d3drm_vector_transform_affine(D3DVECTOR *dst, const D3DVECTOR *v, const struct d3drm_matrix *m) +{ + D3DVECTOR tmp; + + tmp.x = v->x * m->_11 + v->y * m->_21 + v->z * m->_31 + m->_41; + tmp.y = v->x * m->_12 + v->y * m->_22 + v->z * m->_32 + m->_42; + tmp.z = v->x * m->_13 + v->y * m->_23 + v->z * m->_33 + m->_43; + + *dst = tmp; +} + +static HRESULT WINAPI d3drm_frame_array_QueryInterface(IDirect3DRMFrameArray *iface, REFIID riid, void **out) +{ + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRMFrameArray) + || IsEqualGUID(riid, &IID_IUnknown)) + { + IDirect3DRMFrameArray_AddRef(iface); + *out = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI d3drm_frame_array_AddRef(IDirect3DRMFrameArray *iface) +{ + struct d3drm_frame_array *array = impl_from_IDirect3DRMFrameArray(iface); + ULONG refcount = InterlockedIncrement(&array->ref); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI d3drm_frame_array_Release(IDirect3DRMFrameArray *iface) +{ + struct d3drm_frame_array *array = impl_from_IDirect3DRMFrameArray(iface); + ULONG refcount = InterlockedDecrement(&array->ref); + ULONG i; + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + { + for (i = 0; i < array->size; ++i) + { + IDirect3DRMFrame_Release(array->frames[i]); + } + free(array->frames); + free(array); + } + + return refcount; +} + +static DWORD WINAPI d3drm_frame_array_GetSize(IDirect3DRMFrameArray *iface) +{ + struct d3drm_frame_array *array = impl_from_IDirect3DRMFrameArray(iface); + + TRACE("iface %p.\n", iface); + + return array->size; +} + +static HRESULT WINAPI d3drm_frame_array_GetElement(IDirect3DRMFrameArray *iface, + DWORD index, IDirect3DRMFrame **frame) +{ + struct d3drm_frame_array *array = impl_from_IDirect3DRMFrameArray(iface); + + TRACE("iface %p, index %lu, frame %p.\n", iface, index, frame); + + if (!frame) + return D3DRMERR_BADVALUE; + + if (index >= array->size) + { + *frame = NULL; + return D3DRMERR_BADVALUE; + } + + IDirect3DRMFrame_AddRef(array->frames[index]); + *frame = array->frames[index]; + + return D3DRM_OK; +} + +static const struct IDirect3DRMFrameArrayVtbl d3drm_frame_array_vtbl = +{ + d3drm_frame_array_QueryInterface, + d3drm_frame_array_AddRef, + d3drm_frame_array_Release, + d3drm_frame_array_GetSize, + d3drm_frame_array_GetElement, +}; + +static struct d3drm_frame_array *d3drm_frame_array_create(unsigned int frame_count, IDirect3DRMFrame3 **frames) +{ + struct d3drm_frame_array *array; + unsigned int i; + + if (!(array = calloc(1, sizeof(*array)))) + return NULL; + + array->IDirect3DRMFrameArray_iface.lpVtbl = &d3drm_frame_array_vtbl; + array->ref = 1; + array->size = frame_count; + + if (frame_count) + { + if (!(array->frames = calloc(frame_count, sizeof(*array->frames)))) + { + free(array); + return NULL; + } + + for (i = 0; i < frame_count; ++i) + { + IDirect3DRMFrame3_QueryInterface(frames[i], &IID_IDirect3DRMFrame, (void **)&array->frames[i]); + } + } + + return array; +} + +static HRESULT WINAPI d3drm_visual_array_QueryInterface(IDirect3DRMVisualArray *iface, REFIID riid, void **out) +{ + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRMVisualArray) + || IsEqualGUID(riid, &IID_IUnknown)) + { + IDirect3DRMVisualArray_AddRef(iface); + *out = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI d3drm_visual_array_AddRef(IDirect3DRMVisualArray *iface) +{ + struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface); + ULONG refcount = InterlockedIncrement(&array->ref); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI d3drm_visual_array_Release(IDirect3DRMVisualArray *iface) +{ + struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface); + ULONG refcount = InterlockedDecrement(&array->ref); + ULONG i; + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + { + for (i = 0; i < array->size; ++i) + { + IDirect3DRMVisual_Release(array->visuals[i]); + } + free(array->visuals); + free(array); + } + + return refcount; +} + +static DWORD WINAPI d3drm_visual_array_GetSize(IDirect3DRMVisualArray *iface) +{ + struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface); + + TRACE("iface %p.\n", iface); + + return array->size; +} + +static HRESULT WINAPI d3drm_visual_array_GetElement(IDirect3DRMVisualArray *iface, + DWORD index, IDirect3DRMVisual **visual) +{ + struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface); + + TRACE("iface %p, index %lu, visual %p.\n", iface, index, visual); + + if (!visual) + return D3DRMERR_BADVALUE; + + if (index >= array->size) + { + *visual = NULL; + return D3DRMERR_BADVALUE; + } + + IDirect3DRMVisual_AddRef(array->visuals[index]); + *visual = array->visuals[index]; + + return D3DRM_OK; +} + +static const struct IDirect3DRMVisualArrayVtbl d3drm_visual_array_vtbl = +{ + d3drm_visual_array_QueryInterface, + d3drm_visual_array_AddRef, + d3drm_visual_array_Release, + d3drm_visual_array_GetSize, + d3drm_visual_array_GetElement, +}; + +static struct d3drm_visual_array *d3drm_visual_array_create(unsigned int visual_count, IDirect3DRMVisual **visuals) +{ + struct d3drm_visual_array *array; + unsigned int i; + + if (!(array = calloc(1, sizeof(*array)))) + return NULL; + + array->IDirect3DRMVisualArray_iface.lpVtbl = &d3drm_visual_array_vtbl; + array->ref = 1; + array->size = visual_count; + + if (visual_count) + { + if (!(array->visuals = calloc(visual_count, sizeof(*array->visuals)))) + { + free(array); + return NULL; + } + + for (i = 0; i < visual_count; ++i) + { + array->visuals[i] = visuals[i]; + IDirect3DRMVisual_AddRef(array->visuals[i]); + } + } + + return array; +} + +static HRESULT WINAPI d3drm_light_array_QueryInterface(IDirect3DRMLightArray *iface, REFIID riid, void **out) +{ + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRMLightArray) + || IsEqualGUID(riid, &IID_IUnknown)) + { + IDirect3DRMLightArray_AddRef(iface); + *out = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI d3drm_light_array_AddRef(IDirect3DRMLightArray *iface) +{ + struct d3drm_light_array *array = impl_from_IDirect3DRMLightArray(iface); + ULONG refcount = InterlockedIncrement(&array->ref); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI d3drm_light_array_Release(IDirect3DRMLightArray *iface) +{ + struct d3drm_light_array *array = impl_from_IDirect3DRMLightArray(iface); + ULONG refcount = InterlockedDecrement(&array->ref); + ULONG i; + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + { + for (i = 0; i < array->size; ++i) + { + IDirect3DRMLight_Release(array->lights[i]); + } + free(array->lights); + free(array); + } + + return refcount; +} + +static DWORD WINAPI d3drm_light_array_GetSize(IDirect3DRMLightArray *iface) +{ + struct d3drm_light_array *array = impl_from_IDirect3DRMLightArray(iface); + + TRACE("iface %p.\n", iface); + + return array->size; +} + +static HRESULT WINAPI d3drm_light_array_GetElement(IDirect3DRMLightArray *iface, + DWORD index, IDirect3DRMLight **light) +{ + struct d3drm_light_array *array = impl_from_IDirect3DRMLightArray(iface); + + TRACE("iface %p, index %lu, light %p.\n", iface, index, light); + + if (!light) + return D3DRMERR_BADVALUE; + + if (index >= array->size) + { + *light = NULL; + return D3DRMERR_BADVALUE; + } + + IDirect3DRMLight_AddRef(array->lights[index]); + *light = array->lights[index]; + + return D3DRM_OK; +} + +static const struct IDirect3DRMLightArrayVtbl d3drm_light_array_vtbl = +{ + d3drm_light_array_QueryInterface, + d3drm_light_array_AddRef, + d3drm_light_array_Release, + d3drm_light_array_GetSize, + d3drm_light_array_GetElement, +}; + +static struct d3drm_light_array *d3drm_light_array_create(unsigned int light_count, IDirect3DRMLight **lights) +{ + struct d3drm_light_array *array; + unsigned int i; + + if (!(array = calloc(1, sizeof(*array)))) + return NULL; + + array->IDirect3DRMLightArray_iface.lpVtbl = &d3drm_light_array_vtbl; + array->ref = 1; + array->size = light_count; + + if (light_count) + { + if (!(array->lights = calloc(light_count, sizeof(*array->lights)))) + { + free(array); + return NULL; + } + + for (i = 0; i < light_count; ++i) + { + array->lights[i] = lights[i]; + IDirect3DRMLight_AddRef(array->lights[i]); + } + } + + return array; +} + +static HRESULT WINAPI d3drm_frame3_QueryInterface(IDirect3DRMFrame3 *iface, REFIID riid, void **out) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRMFrame) + || IsEqualGUID(riid, &IID_IDirect3DRMObject) + || IsEqualGUID(riid, &IID_IDirect3DRMVisual) + || IsEqualGUID(riid, &IID_IUnknown)) + { + *out = &frame->IDirect3DRMFrame_iface; + } + else if (IsEqualGUID(riid, &IID_IDirect3DRMFrame2)) + { + *out = &frame->IDirect3DRMFrame2_iface; + } + else if (IsEqualGUID(riid, &IID_IDirect3DRMFrame3)) + { + *out = &frame->IDirect3DRMFrame3_iface; + } + else + { + *out = NULL; + WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid)); + return CLASS_E_CLASSNOTAVAILABLE; + } + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} + +static HRESULT WINAPI d3drm_frame2_QueryInterface(IDirect3DRMFrame2 *iface, REFIID riid, void **out) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + return d3drm_frame3_QueryInterface(&frame->IDirect3DRMFrame3_iface, riid, out); +} + +static HRESULT WINAPI d3drm_frame1_QueryInterface(IDirect3DRMFrame *iface, REFIID riid, void **out) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + return d3drm_frame3_QueryInterface(&frame->IDirect3DRMFrame3_iface, riid, out); +} + +static ULONG WINAPI d3drm_frame3_AddRef(IDirect3DRMFrame3 *iface) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + ULONG refcount = InterlockedIncrement(&frame->ref); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI d3drm_frame2_AddRef(IDirect3DRMFrame2 *iface) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_frame3_AddRef(&frame->IDirect3DRMFrame3_iface); +} + +static ULONG WINAPI d3drm_frame1_AddRef(IDirect3DRMFrame *iface) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_frame3_AddRef(&frame->IDirect3DRMFrame3_iface); +} + +static ULONG WINAPI d3drm_frame3_Release(IDirect3DRMFrame3 *iface) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + ULONG refcount = InterlockedDecrement(&frame->ref); + ULONG i; + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + { + d3drm_object_cleanup((IDirect3DRMObject *)&frame->IDirect3DRMFrame_iface, &frame->obj); + for (i = 0; i < frame->nb_children; ++i) + { + IDirect3DRMFrame3_Release(frame->children[i]); + } + free(frame->children); + for (i = 0; i < frame->nb_visuals; ++i) + { + IDirect3DRMVisual_Release(frame->visuals[i]); + } + free(frame->visuals); + for (i = 0; i < frame->nb_lights; ++i) + { + IDirect3DRMLight_Release(frame->lights[i]); + } + free(frame->lights); + IDirect3DRM_Release(frame->d3drm); + free(frame); + } + + return refcount; +} + +static ULONG WINAPI d3drm_frame2_Release(IDirect3DRMFrame2 *iface) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_frame3_Release(&frame->IDirect3DRMFrame3_iface); +} + +static ULONG WINAPI d3drm_frame1_Release(IDirect3DRMFrame *iface) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_frame3_Release(&frame->IDirect3DRMFrame3_iface); +} + +static HRESULT WINAPI d3drm_frame3_Clone(IDirect3DRMFrame3 *iface, + IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_Clone(IDirect3DRMFrame2 *iface, + IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_Clone(IDirect3DRMFrame *iface, + IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_AddDestroyCallback(IDirect3DRMFrame3 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_add_destroy_callback(&frame->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_frame2_AddDestroyCallback(IDirect3DRMFrame2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return IDirect3DRMFrame3_AddDestroyCallback(&frame->IDirect3DRMFrame3_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_frame1_AddDestroyCallback(IDirect3DRMFrame *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return IDirect3DRMFrame3_AddDestroyCallback(&frame->IDirect3DRMFrame3_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_frame3_DeleteDestroyCallback(IDirect3DRMFrame3 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_delete_destroy_callback(&frame->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_frame2_DeleteDestroyCallback(IDirect3DRMFrame2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return IDirect3DRMFrame3_DeleteDestroyCallback(&frame->IDirect3DRMFrame3_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_frame1_DeleteDestroyCallback(IDirect3DRMFrame *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return IDirect3DRMFrame3_DeleteDestroyCallback(&frame->IDirect3DRMFrame3_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_frame3_SetAppData(IDirect3DRMFrame3 *iface, DWORD data) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + frame->obj.appdata = data; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_SetAppData(IDirect3DRMFrame2 *iface, DWORD data) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + return d3drm_frame3_SetAppData(&frame->IDirect3DRMFrame3_iface, data); +} + +static HRESULT WINAPI d3drm_frame1_SetAppData(IDirect3DRMFrame *iface, DWORD data) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + return d3drm_frame3_SetAppData(&frame->IDirect3DRMFrame3_iface, data); +} + +static DWORD WINAPI d3drm_frame3_GetAppData(IDirect3DRMFrame3 *iface) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p.\n", iface); + + return frame->obj.appdata; +} + +static DWORD WINAPI d3drm_frame2_GetAppData(IDirect3DRMFrame2 *iface) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_frame3_GetAppData(&frame->IDirect3DRMFrame3_iface); +} + +static DWORD WINAPI d3drm_frame1_GetAppData(IDirect3DRMFrame *iface) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_frame3_GetAppData(&frame->IDirect3DRMFrame3_iface); +} + +static HRESULT WINAPI d3drm_frame3_SetName(IDirect3DRMFrame3 *iface, const char *name) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_object_set_name(&frame->obj, name); +} + +static HRESULT WINAPI d3drm_frame2_SetName(IDirect3DRMFrame2 *iface, const char *name) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_frame3_SetName(&frame->IDirect3DRMFrame3_iface, name); +} + +static HRESULT WINAPI d3drm_frame1_SetName(IDirect3DRMFrame *iface, const char *name) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_frame3_SetName(&frame->IDirect3DRMFrame3_iface, name); +} + +static HRESULT WINAPI d3drm_frame3_GetName(IDirect3DRMFrame3 *iface, DWORD *size, char *name) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_name(&frame->obj, size, name); +} + +static HRESULT WINAPI d3drm_frame2_GetName(IDirect3DRMFrame2 *iface, DWORD *size, char *name) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_frame3_GetName(&frame->IDirect3DRMFrame3_iface, size, name); +} + +static HRESULT WINAPI d3drm_frame1_GetName(IDirect3DRMFrame *iface, DWORD *size, char *name) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_frame3_GetName(&frame->IDirect3DRMFrame3_iface, size, name); +} + +static HRESULT WINAPI d3drm_frame3_GetClassName(IDirect3DRMFrame3 *iface, DWORD *size, char *name) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_class_name(&frame->obj, size, name); +} + +static HRESULT WINAPI d3drm_frame2_GetClassName(IDirect3DRMFrame2 *iface, DWORD *size, char *name) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_frame3_GetClassName(&frame->IDirect3DRMFrame3_iface, size, name); +} + +static HRESULT WINAPI d3drm_frame1_GetClassName(IDirect3DRMFrame *iface, DWORD *size, char *name) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_frame3_GetClassName(&frame->IDirect3DRMFrame3_iface, size, name); +} + +static HRESULT WINAPI d3drm_frame3_AddChild(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *child) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + struct d3drm_frame *child_obj = unsafe_impl_from_IDirect3DRMFrame3(child); + + TRACE("iface %p, child %p.\n", iface, child); + + if (!child_obj) + return D3DRMERR_BADOBJECT; + + if (child_obj->parent) + { + IDirect3DRMFrame3* parent = &child_obj->parent->IDirect3DRMFrame3_iface; + + if (parent == iface) + { + /* Passed frame is already a child so return success */ + return D3DRM_OK; + } + else + { + /* Remove parent and continue */ + IDirect3DRMFrame3_DeleteChild(parent, child); + } + } + + if (!d3drm_array_reserve((void **)&frame->children, &frame->children_size, + frame->nb_children + 1, sizeof(*frame->children))) + return E_OUTOFMEMORY; + + frame->children[frame->nb_children++] = child; + IDirect3DRMFrame3_AddRef(child); + child_obj->parent = frame; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_AddChild(IDirect3DRMFrame2 *iface, IDirect3DRMFrame *child) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + IDirect3DRMFrame3 *child3; + HRESULT hr; + + TRACE("iface %p, child %p.\n", iface, child); + + if (!child) + return D3DRMERR_BADOBJECT; + hr = IDirect3DRMFrame_QueryInterface(child, &IID_IDirect3DRMFrame3, (void **)&child3); + if (hr != S_OK) + return D3DRMERR_BADOBJECT; + IDirect3DRMFrame_Release(child); + + return d3drm_frame3_AddChild(&frame->IDirect3DRMFrame3_iface, child3); +} + +static HRESULT WINAPI d3drm_frame1_AddChild(IDirect3DRMFrame *iface, IDirect3DRMFrame *child) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + struct d3drm_frame *child_frame = unsafe_impl_from_IDirect3DRMFrame(child); + + TRACE("iface %p, child %p.\n", iface, child); + + if (!child_frame) + return D3DRMERR_BADOBJECT; + + return d3drm_frame3_AddChild(&frame->IDirect3DRMFrame3_iface, &child_frame->IDirect3DRMFrame3_iface); +} + +static HRESULT WINAPI d3drm_frame3_AddLight(IDirect3DRMFrame3 *iface, IDirect3DRMLight *light) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + ULONG i; + + TRACE("iface %p, light %p.\n", iface, light); + + if (!light) + return D3DRMERR_BADOBJECT; + + /* Check if already existing and return gracefully without increasing ref count */ + for (i = 0; i < frame->nb_lights; i++) + if (frame->lights[i] == light) + return D3DRM_OK; + + if (!d3drm_array_reserve((void **)&frame->lights, &frame->lights_size, + frame->nb_lights + 1, sizeof(*frame->lights))) + return E_OUTOFMEMORY; + + frame->lights[frame->nb_lights++] = light; + IDirect3DRMLight_AddRef(light); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_AddLight(IDirect3DRMFrame2 *iface, IDirect3DRMLight *light) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, light %p.\n", iface, light); + + return d3drm_frame3_AddLight(&frame->IDirect3DRMFrame3_iface, light); +} + +static HRESULT WINAPI d3drm_frame1_AddLight(IDirect3DRMFrame *iface, IDirect3DRMLight *light) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, light %p.\n", iface, light); + + return d3drm_frame3_AddLight(&frame->IDirect3DRMFrame3_iface, light); +} + +static HRESULT WINAPI d3drm_frame3_AddMoveCallback(IDirect3DRMFrame3 *iface, + D3DRMFRAME3MOVECALLBACK cb, void *ctx, DWORD flags) +{ + FIXME("iface %p, cb %p, ctx %p flags %#lx stub!\n", iface, cb, ctx, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_AddMoveCallback(IDirect3DRMFrame2 *iface, + D3DRMFRAMEMOVECALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_AddMoveCallback(IDirect3DRMFrame *iface, + D3DRMFRAMEMOVECALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_AddTransform(IDirect3DRMFrame3 *iface, + D3DRMCOMBINETYPE type, D3DRMMATRIX4D matrix) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + const struct d3drm_matrix *m = d3drm_matrix(matrix); + + TRACE("iface %p, type %#x, matrix %p.\n", iface, type, matrix); + + if (m->_14 != 0.0f || m->_24 != 0.0f || m->_34 != 0.0f || m->_44 != 1.0f) + return D3DRMERR_BADVALUE; + + switch (type) + { + case D3DRMCOMBINE_REPLACE: + frame->transform = *m; + break; + + case D3DRMCOMBINE_BEFORE: + d3drm_matrix_multiply_affine(&frame->transform, m, &frame->transform); + break; + + case D3DRMCOMBINE_AFTER: + d3drm_matrix_multiply_affine(&frame->transform, &frame->transform, m); + break; + + default: + FIXME("Unhandled type %#x.\n", type); + return D3DRMERR_BADVALUE; + } + + return S_OK; +} + +static HRESULT WINAPI d3drm_frame2_AddTransform(IDirect3DRMFrame2 *iface, + D3DRMCOMBINETYPE type, D3DRMMATRIX4D matrix) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, type %#x, matrix %p.\n", iface, type, matrix); + + return d3drm_frame3_AddTransform(&frame->IDirect3DRMFrame3_iface, type, matrix); +} + +static HRESULT WINAPI d3drm_frame1_AddTransform(IDirect3DRMFrame *iface, + D3DRMCOMBINETYPE type, D3DRMMATRIX4D matrix) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, type %#x, matrix %p.\n", iface, type, matrix); + + return d3drm_frame3_AddTransform(&frame->IDirect3DRMFrame3_iface, type, matrix); +} + +static HRESULT WINAPI d3drm_frame3_AddTranslation(IDirect3DRMFrame3 *iface, + D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e.\n", iface, type, x, y, z); + + switch (type) + { + case D3DRMCOMBINE_REPLACE: + frame->transform = identity; + frame->transform._41 = x; + frame->transform._42 = y; + frame->transform._43 = z; + break; + + case D3DRMCOMBINE_BEFORE: + frame->transform._41 += x * frame->transform._11 + y * frame->transform._21 + z * frame->transform._31; + frame->transform._42 += x * frame->transform._12 + y * frame->transform._22 + z * frame->transform._32; + frame->transform._43 += x * frame->transform._13 + y * frame->transform._23 + z * frame->transform._33; + break; + + case D3DRMCOMBINE_AFTER: + frame->transform._41 += x; + frame->transform._42 += y; + frame->transform._43 += z; + break; + + default: + FIXME("Unhandled type %#x.\n", type); + return D3DRMERR_BADVALUE; + } + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_AddTranslation(IDirect3DRMFrame2 *iface, + D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e.\n", iface, type, x, y, z); + + return d3drm_frame3_AddTranslation(&frame->IDirect3DRMFrame3_iface, type, x, y, z); +} + +static HRESULT WINAPI d3drm_frame1_AddTranslation(IDirect3DRMFrame *iface, + D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e.\n", iface, type, x, y, z); + + return d3drm_frame3_AddTranslation(&frame->IDirect3DRMFrame3_iface, type, x, y, z); +} + +static HRESULT WINAPI d3drm_frame3_AddScale(IDirect3DRMFrame3 *iface, + D3DRMCOMBINETYPE type, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, type %#x, sx %.8e, sy %.8e, sz %.8e.\n", iface, type, sx, sy, sz); + + switch (type) + { + case D3DRMCOMBINE_REPLACE: + frame->transform = identity; + frame->transform._11 = sx; + frame->transform._22 = sy; + frame->transform._33 = sz; + break; + + case D3DRMCOMBINE_BEFORE: + frame->transform._11 *= sx; + frame->transform._12 *= sx; + frame->transform._13 *= sx; + frame->transform._21 *= sy; + frame->transform._22 *= sy; + frame->transform._23 *= sy; + frame->transform._31 *= sz; + frame->transform._32 *= sz; + frame->transform._33 *= sz; + break; + + case D3DRMCOMBINE_AFTER: + frame->transform._11 *= sx; + frame->transform._12 *= sy; + frame->transform._13 *= sz; + frame->transform._21 *= sx; + frame->transform._22 *= sy; + frame->transform._23 *= sz; + frame->transform._31 *= sx; + frame->transform._32 *= sy; + frame->transform._33 *= sz; + frame->transform._41 *= sx; + frame->transform._42 *= sy; + frame->transform._43 *= sz; + break; + + default: + FIXME("Unhandled type %#x.\n", type); + return D3DRMERR_BADVALUE; + } + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_AddScale(IDirect3DRMFrame2 *iface, + D3DRMCOMBINETYPE type, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, type %#x, sx %.8e, sy %.8e, sz %.8e.\n", iface, type, sx, sy, sz); + + return d3drm_frame3_AddScale(&frame->IDirect3DRMFrame3_iface, type, sx, sy, sz); +} + +static HRESULT WINAPI d3drm_frame1_AddScale(IDirect3DRMFrame *iface, + D3DRMCOMBINETYPE type, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, type %#x, sx %.8e, sy %.8e, sz %.8e.\n", iface, type, sx, sy, sz); + + return d3drm_frame3_AddScale(&frame->IDirect3DRMFrame3_iface, type, sx, sy, sz); +} + +static HRESULT WINAPI d3drm_frame3_AddRotation(IDirect3DRMFrame3 *iface, + D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + struct d3drm_matrix m; + D3DVECTOR axis; + + TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e, theta %.8e.\n", iface, type, x, y, z, theta); + + axis.x = x; + axis.y = y; + axis.z = z; + + switch (type) + { + case D3DRMCOMBINE_REPLACE: + d3drm_matrix_set_rotation(&frame->transform, &axis, theta); + break; + + case D3DRMCOMBINE_BEFORE: + d3drm_matrix_set_rotation(&m, &axis, theta); + d3drm_matrix_multiply_affine(&frame->transform, &m, &frame->transform); + break; + + case D3DRMCOMBINE_AFTER: + d3drm_matrix_set_rotation(&m, &axis, theta); + d3drm_matrix_multiply_affine(&frame->transform, &frame->transform, &m); + break; + + default: + FIXME("Unhandled type %#x.\n", type); + return D3DRMERR_BADVALUE; + } + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_AddRotation(IDirect3DRMFrame2 *iface, + D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e, theta %.8e.\n", iface, type, x, y, z, theta); + + return d3drm_frame3_AddRotation(&frame->IDirect3DRMFrame3_iface, type, x, y, z, theta); +} + +static HRESULT WINAPI d3drm_frame1_AddRotation(IDirect3DRMFrame *iface, + D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e, theta %.8e.\n", iface, type, x, y, z, theta); + + return d3drm_frame3_AddRotation(&frame->IDirect3DRMFrame3_iface, type, x, y, z, theta); +} + +static HRESULT WINAPI d3drm_frame3_AddVisual(IDirect3DRMFrame3 *iface, IUnknown *visual) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + ULONG i; + + TRACE("iface %p, visual %p.\n", iface, visual); + + if (!visual) + return D3DRMERR_BADOBJECT; + + /* Check if already existing and return gracefully without increasing ref count */ + for (i = 0; i < frame->nb_visuals; i++) + if (frame->visuals[i] == (IDirect3DRMVisual *)visual) + return D3DRM_OK; + + if (!d3drm_array_reserve((void **)&frame->visuals, &frame->visuals_size, + frame->nb_visuals + 1, sizeof(*frame->visuals))) + return E_OUTOFMEMORY; + + frame->visuals[frame->nb_visuals++] = (IDirect3DRMVisual *)visual; + IDirect3DRMVisual_AddRef(visual); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_AddVisual(IDirect3DRMFrame2 *iface, IDirect3DRMVisual *visual) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, visual %p.\n", iface, visual); + + return d3drm_frame3_AddVisual(&frame->IDirect3DRMFrame3_iface, (IUnknown *)visual); +} + +static HRESULT WINAPI d3drm_frame1_AddVisual(IDirect3DRMFrame *iface, IDirect3DRMVisual *visual) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, visual %p.\n", iface, visual); + + return d3drm_frame3_AddVisual(&frame->IDirect3DRMFrame3_iface, (IUnknown *)visual); +} + +static HRESULT WINAPI d3drm_frame3_GetChildren(IDirect3DRMFrame3 *iface, IDirect3DRMFrameArray **children) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + struct d3drm_frame_array *array; + + TRACE("iface %p, children %p.\n", iface, children); + + if (!children) + return D3DRMERR_BADVALUE; + + if (!(array = d3drm_frame_array_create(frame->nb_children, frame->children))) + return E_OUTOFMEMORY; + + *children = &array->IDirect3DRMFrameArray_iface; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_GetChildren(IDirect3DRMFrame2 *iface, IDirect3DRMFrameArray **children) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, children %p.\n", iface, children); + + return d3drm_frame3_GetChildren(&frame->IDirect3DRMFrame3_iface, children); +} + +static HRESULT WINAPI d3drm_frame1_GetChildren(IDirect3DRMFrame *iface, IDirect3DRMFrameArray **children) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, children %p.\n", iface, children); + + return d3drm_frame3_GetChildren(&frame->IDirect3DRMFrame3_iface, children); +} + +static D3DCOLOR WINAPI d3drm_frame3_GetColor(IDirect3DRMFrame3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return 0; +} + +static D3DCOLOR WINAPI d3drm_frame2_GetColor(IDirect3DRMFrame2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return 0; +} + +static D3DCOLOR WINAPI d3drm_frame1_GetColor(IDirect3DRMFrame *iface) +{ + FIXME("iface %p stub!\n", iface); + + return 0; +} + +static HRESULT WINAPI d3drm_frame3_GetLights(IDirect3DRMFrame3 *iface, IDirect3DRMLightArray **lights) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + struct d3drm_light_array *array; + + TRACE("iface %p, lights %p.\n", iface, lights); + + if (!lights) + return D3DRMERR_BADVALUE; + + if (!(array = d3drm_light_array_create(frame->nb_lights, frame->lights))) + return E_OUTOFMEMORY; + + *lights = &array->IDirect3DRMLightArray_iface; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_GetLights(IDirect3DRMFrame2 *iface, IDirect3DRMLightArray **lights) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, lights %p.\n", iface, lights); + + return d3drm_frame3_GetLights(&frame->IDirect3DRMFrame3_iface, lights); +} + +static HRESULT WINAPI d3drm_frame1_GetLights(IDirect3DRMFrame *iface, IDirect3DRMLightArray **lights) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, lights %p.\n", iface, lights); + + return d3drm_frame3_GetLights(&frame->IDirect3DRMFrame3_iface, lights); +} + +static D3DRMMATERIALMODE WINAPI d3drm_frame3_GetMaterialMode(IDirect3DRMFrame3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRMMATERIAL_FROMPARENT; +} + +static D3DRMMATERIALMODE WINAPI d3drm_frame2_GetMaterialMode(IDirect3DRMFrame2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRMMATERIAL_FROMPARENT; +} + +static D3DRMMATERIALMODE WINAPI d3drm_frame1_GetMaterialMode(IDirect3DRMFrame *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRMMATERIAL_FROMPARENT; +} + +static HRESULT WINAPI d3drm_frame3_GetParent(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 **parent) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, parent %p.\n", iface, parent); + + if (!parent) + return D3DRMERR_BADVALUE; + + if (frame->parent) + { + *parent = &frame->parent->IDirect3DRMFrame3_iface; + IDirect3DRMFrame_AddRef(*parent); + } + else + { + *parent = NULL; + } + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_GetParent(IDirect3DRMFrame2 *iface, IDirect3DRMFrame **parent) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, parent %p.\n", iface, parent); + + if (!parent) + return D3DRMERR_BADVALUE; + + if (frame->parent) + { + *parent = &frame->parent->IDirect3DRMFrame_iface; + IDirect3DRMFrame_AddRef(*parent); + } + else + { + *parent = NULL; + } + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame1_GetParent(IDirect3DRMFrame *iface, IDirect3DRMFrame **parent) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, parent %p.\n", iface, parent); + + return d3drm_frame2_GetParent(&frame->IDirect3DRMFrame2_iface, parent); +} + +static HRESULT WINAPI d3drm_frame3_GetPosition(IDirect3DRMFrame3 *iface, + IDirect3DRMFrame3 *reference, D3DVECTOR *position) +{ + FIXME("iface %p, reference %p, position %p stub!\n", iface, reference, position); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_GetPosition(IDirect3DRMFrame2 *iface, + IDirect3DRMFrame *reference, D3DVECTOR *position) +{ + FIXME("iface %p, reference %p, position %p stub!\n", iface, reference, position); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_GetPosition(IDirect3DRMFrame *iface, + IDirect3DRMFrame *reference, D3DVECTOR *position) +{ + FIXME("iface %p, reference %p, position %p stub!\n", iface, reference, position); + + return E_NOTIMPL; +} + + +static HRESULT WINAPI d3drm_frame3_GetRotation(IDirect3DRMFrame3 *iface, + IDirect3DRMFrame3 *reference, D3DVECTOR *axis, D3DVALUE *theta) +{ + FIXME("iface %p, reference %p, axis %p, theta %p stub!\n", iface, reference, axis, theta); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_GetRotation(IDirect3DRMFrame2 *iface, + IDirect3DRMFrame *reference, D3DVECTOR *axis, D3DVALUE *theta) +{ + FIXME("iface %p, reference %p, axis %p, theta %p stub!\n", iface, reference, axis, theta); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_GetRotation(IDirect3DRMFrame *iface, + IDirect3DRMFrame *reference, D3DVECTOR *axis, D3DVALUE *theta) +{ + FIXME("iface %p, reference %p, axis %p, theta %p stub!\n", iface, reference, axis, theta); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_GetScene(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 **scene) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, scene %p.\n", iface, scene); + + if (!scene) + return D3DRMERR_BADVALUE; + + while (frame->parent) + frame = frame->parent; + + *scene = &frame->IDirect3DRMFrame3_iface; + IDirect3DRMFrame3_AddRef(*scene); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_GetScene(IDirect3DRMFrame2 *iface, IDirect3DRMFrame **scene) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + IDirect3DRMFrame3 *frame3; + HRESULT hr; + + TRACE("iface %p, scene %p.\n", iface, scene); + + if (!scene) + return D3DRMERR_BADVALUE; + + hr = IDirect3DRMFrame3_GetScene(&frame->IDirect3DRMFrame3_iface, &frame3); + if (FAILED(hr) || !frame3) + { + *scene = NULL; + return hr; + } + + hr = IDirect3DRMFrame3_QueryInterface(frame3, &IID_IDirect3DRMFrame, (void **)scene); + IDirect3DRMFrame3_Release(frame3); + + return hr; +} + +static HRESULT WINAPI d3drm_frame1_GetScene(IDirect3DRMFrame *iface, IDirect3DRMFrame **scene) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, scene %p.\n", iface, scene); + + return d3drm_frame2_GetScene(&frame->IDirect3DRMFrame2_iface, scene); +} + +static D3DRMSORTMODE WINAPI d3drm_frame3_GetSortMode(IDirect3DRMFrame3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRMSORT_FROMPARENT; +} + +static D3DRMSORTMODE WINAPI d3drm_frame2_GetSortMode(IDirect3DRMFrame2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRMSORT_FROMPARENT; +} + +static D3DRMSORTMODE WINAPI d3drm_frame1_GetSortMode(IDirect3DRMFrame *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRMSORT_FROMPARENT; +} + +static HRESULT WINAPI d3drm_frame3_GetTexture(IDirect3DRMFrame3 *iface, IDirect3DRMTexture3 **texture) +{ + FIXME("iface %p, texture %p stub!\n", iface, texture); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_GetTexture(IDirect3DRMFrame2 *iface, IDirect3DRMTexture **texture) +{ + FIXME("iface %p, texture %p stub!\n", iface, texture); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_GetTexture(IDirect3DRMFrame *iface, IDirect3DRMTexture **texture) +{ + FIXME("iface %p, texture %p stub!\n", iface, texture); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_GetTransform(IDirect3DRMFrame3 *iface, + IDirect3DRMFrame3 *reference, D3DRMMATRIX4D matrix) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + struct d3drm_matrix *m = d3drm_matrix(matrix); + + TRACE("iface %p, reference %p, matrix %p.\n", iface, reference, matrix); + + if (reference) + FIXME("Ignoring reference frame %p.\n", reference); + + *m = frame->transform; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_GetTransform(IDirect3DRMFrame2 *iface, D3DRMMATRIX4D matrix) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + struct d3drm_matrix *m = d3drm_matrix(matrix); + + TRACE("iface %p, matrix %p.\n", iface, matrix); + + *m = frame->transform; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame1_GetTransform(IDirect3DRMFrame *iface, D3DRMMATRIX4D matrix) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, matrix %p.\n", iface, matrix); + + return d3drm_frame2_GetTransform(&frame->IDirect3DRMFrame2_iface, matrix); +} + +static HRESULT WINAPI d3drm_frame3_GetVelocity(IDirect3DRMFrame3 *iface, + IDirect3DRMFrame3 *reference, D3DVECTOR *velocity, BOOL with_rotation) +{ + FIXME("iface %p, reference %p, velocity %p, with_rotation %#x stub!\n", + iface, reference, velocity, with_rotation); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_GetVelocity(IDirect3DRMFrame2 *iface, + IDirect3DRMFrame *reference, D3DVECTOR *velocity, BOOL with_rotation) +{ + FIXME("iface %p, reference %p, velocity %p, with_rotation %#x stub!\n", + iface, reference, velocity, with_rotation); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_GetVelocity(IDirect3DRMFrame *iface, + IDirect3DRMFrame *reference, D3DVECTOR *velocity, BOOL with_rotation) +{ + FIXME("iface %p, reference %p, velocity %p, with_rotation %#x stub!\n", + iface, reference, velocity, with_rotation); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_GetOrientation(IDirect3DRMFrame3 *iface, + IDirect3DRMFrame3 *reference, D3DVECTOR *dir, D3DVECTOR *up) +{ + FIXME("iface %p, reference %p, dir %p, up %p stub!\n", iface, reference, dir, up); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_GetOrientation(IDirect3DRMFrame2 *iface, + IDirect3DRMFrame *reference, D3DVECTOR *dir, D3DVECTOR *up) +{ + FIXME("iface %p, reference %p, dir %p, up %p stub!\n", iface, reference, dir, up); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_GetOrientation(IDirect3DRMFrame *iface, + IDirect3DRMFrame *reference, D3DVECTOR *dir, D3DVECTOR *up) +{ + FIXME("iface %p, reference %p, dir %p, up %p stub!\n", iface, reference, dir, up); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_GetVisuals(IDirect3DRMFrame3 *iface, DWORD *count, IUnknown **visuals) +{ + FIXME("iface %p, count %p, visuals %p stub!\n", iface, count, visuals); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_GetVisuals(IDirect3DRMFrame2 *iface, IDirect3DRMVisualArray **visuals) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + struct d3drm_visual_array *array; + + TRACE("iface %p, visuals %p.\n", iface, visuals); + + if (!visuals) + return D3DRMERR_BADVALUE; + + if (!(array = d3drm_visual_array_create(frame->nb_visuals, frame->visuals))) + return E_OUTOFMEMORY; + + *visuals = &array->IDirect3DRMVisualArray_iface; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame1_GetVisuals(IDirect3DRMFrame *iface, IDirect3DRMVisualArray **visuals) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, visuals %p.\n", iface, visuals); + + return d3drm_frame2_GetVisuals(&frame->IDirect3DRMFrame2_iface, visuals); +} + +static HRESULT WINAPI d3drm_frame2_GetTextureTopology(IDirect3DRMFrame2 *iface, BOOL *wrap_u, BOOL *wrap_v) +{ + FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_GetTextureTopology(IDirect3DRMFrame *iface, BOOL *wrap_u, BOOL *wrap_v) +{ + FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_InverseTransform(IDirect3DRMFrame3 *iface, D3DVECTOR *d, D3DVECTOR *s) +{ + FIXME("iface %p, d %p, s %p stub!\n", iface, d, s); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_InverseTransform(IDirect3DRMFrame2 *iface, D3DVECTOR *d, D3DVECTOR *s) +{ + FIXME("iface %p, d %p, s %p stub!\n", iface, d, s); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_InverseTransform(IDirect3DRMFrame *iface, D3DVECTOR *d, D3DVECTOR *s) +{ + FIXME("iface %p, d %p, s %p stub!\n", iface, d, s); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_Load(IDirect3DRMFrame3 *iface, void *filename, + void *name, D3DRMLOADOPTIONS flags, D3DRMLOADTEXTURE3CALLBACK cb, void *ctx) +{ + FIXME("iface %p, filename %p, name %p, flags %#lx, cb %p, ctx %p stub!\n", + iface, filename, name, flags, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_Load(IDirect3DRMFrame2 *iface, void *filename, + void *name, D3DRMLOADOPTIONS flags, D3DRMLOADTEXTURECALLBACK cb, void *ctx) +{ + FIXME("iface %p, filename %p, name %p, flags %#lx, cb %p, ctx %p stub!\n", + iface, filename, name, flags, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_Load(IDirect3DRMFrame *iface, void *filename, + void *name, D3DRMLOADOPTIONS flags, D3DRMLOADTEXTURECALLBACK cb, void *ctx) +{ + FIXME("iface %p, filename %p, name %p, flags %#lx, cb %p, ctx %p stub!\n", + iface, filename, name, flags, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_LookAt(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *target, + IDirect3DRMFrame3 *reference, D3DRMFRAMECONSTRAINT constraint) +{ + FIXME("iface %p, target %p, reference %p, constraint %#x stub!\n", iface, target, reference, constraint); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_LookAt(IDirect3DRMFrame2 *iface, IDirect3DRMFrame *target, + IDirect3DRMFrame *reference, D3DRMFRAMECONSTRAINT constraint) +{ + FIXME("iface %p, target %p, reference %p, constraint %#x stub!\n", iface, target, reference, constraint); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_LookAt(IDirect3DRMFrame *iface, IDirect3DRMFrame *target, + IDirect3DRMFrame *reference, D3DRMFRAMECONSTRAINT constraint) +{ + FIXME("iface %p, target %p, reference %p, constraint %#x stub!\n", iface, target, reference, constraint); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_Move(IDirect3DRMFrame3 *iface, D3DVALUE delta) +{ + FIXME("iface %p, delta %.8e stub!\n", iface, delta); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_Move(IDirect3DRMFrame2 *iface, D3DVALUE delta) +{ + FIXME("iface %p, delta %.8e stub!\n", iface, delta); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_Move(IDirect3DRMFrame *iface, D3DVALUE delta) +{ + FIXME("iface %p, delta %.8e stub!\n", iface, delta); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_DeleteChild(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *child) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + struct d3drm_frame *child_impl = unsafe_impl_from_IDirect3DRMFrame3(child); + ULONG i; + + TRACE("iface %p, child %p.\n", iface, child); + + if (!child_impl) + return D3DRMERR_BADOBJECT; + + /* Check if child exists */ + for (i = 0; i < frame->nb_children; ++i) + { + if (frame->children[i] == child) + break; + } + + if (i == frame->nb_children) + return D3DRMERR_BADVALUE; + + memmove(frame->children + i, frame->children + i + 1, sizeof(*frame->children) * (frame->nb_children - 1 - i)); + IDirect3DRMFrame3_Release(child); + child_impl->parent = NULL; + --frame->nb_children; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_DeleteChild(IDirect3DRMFrame2 *iface, IDirect3DRMFrame *child) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + IDirect3DRMFrame3 *child3; + HRESULT hr; + + TRACE("iface %p, child %p.\n", iface, child); + + if (!child) + return D3DRMERR_BADOBJECT; + if (FAILED(hr = IDirect3DRMFrame_QueryInterface(child, &IID_IDirect3DRMFrame3, (void **)&child3))) + return D3DRMERR_BADOBJECT; + IDirect3DRMFrame_Release(child); + + return d3drm_frame3_DeleteChild(&frame->IDirect3DRMFrame3_iface, child3); +} + +static HRESULT WINAPI d3drm_frame1_DeleteChild(IDirect3DRMFrame *iface, IDirect3DRMFrame *child) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + struct d3drm_frame *child_frame = unsafe_impl_from_IDirect3DRMFrame(child); + + TRACE("iface %p, child %p.\n", iface, child); + + if (!child_frame) + return D3DRMERR_BADOBJECT; + + return d3drm_frame3_DeleteChild(&frame->IDirect3DRMFrame3_iface, &child_frame->IDirect3DRMFrame3_iface); +} + +static HRESULT WINAPI d3drm_frame3_DeleteLight(IDirect3DRMFrame3 *iface, IDirect3DRMLight *light) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + ULONG i; + + TRACE("iface %p, light %p.\n", iface, light); + + if (!light) + return D3DRMERR_BADOBJECT; + + /* Check if visual exists */ + for (i = 0; i < frame->nb_lights; ++i) + { + if (frame->lights[i] == light) + break; + } + + if (i == frame->nb_lights) + return D3DRMERR_BADVALUE; + + memmove(frame->lights + i, frame->lights + i + 1, sizeof(*frame->lights) * (frame->nb_lights - 1 - i)); + IDirect3DRMLight_Release(light); + --frame->nb_lights; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_DeleteLight(IDirect3DRMFrame2 *iface, IDirect3DRMLight *light) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, light %p.\n", iface, light); + + return d3drm_frame3_DeleteLight(&frame->IDirect3DRMFrame3_iface, light); +} + +static HRESULT WINAPI d3drm_frame1_DeleteLight(IDirect3DRMFrame *iface, IDirect3DRMLight *light) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, light %p.\n", iface, light); + + return d3drm_frame3_DeleteLight(&frame->IDirect3DRMFrame3_iface, light); +} + +static HRESULT WINAPI d3drm_frame3_DeleteMoveCallback(IDirect3DRMFrame3 *iface, + D3DRMFRAME3MOVECALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_DeleteMoveCallback(IDirect3DRMFrame2 *iface, + D3DRMFRAMEMOVECALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_DeleteMoveCallback(IDirect3DRMFrame *iface, + D3DRMFRAMEMOVECALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_DeleteVisual(IDirect3DRMFrame3 *iface, IUnknown *visual) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + ULONG i; + + TRACE("iface %p, visual %p.\n", iface, visual); + + if (!visual) + return D3DRMERR_BADOBJECT; + + /* Check if visual exists */ + for (i = 0; i < frame->nb_visuals; ++i) + { + if (frame->visuals[i] == (IDirect3DRMVisual *)visual) + break; + } + + if (i == frame->nb_visuals) + return D3DRMERR_BADVALUE; + + memmove(frame->visuals + i, frame->visuals + i + 1, sizeof(*frame->visuals) * (frame->nb_visuals - 1 - i)); + IDirect3DRMVisual_Release(visual); + --frame->nb_visuals; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_DeleteVisual(IDirect3DRMFrame2 *iface, IDirect3DRMVisual *visual) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, visual %p.\n", iface, visual); + + return d3drm_frame3_DeleteVisual(&frame->IDirect3DRMFrame3_iface, (IUnknown *)visual); +} + +static HRESULT WINAPI d3drm_frame1_DeleteVisual(IDirect3DRMFrame *iface, IDirect3DRMVisual *visual) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, visual %p.\n", iface, visual); + + return d3drm_frame3_DeleteVisual(&frame->IDirect3DRMFrame3_iface, (IUnknown *)visual); +} + +static D3DCOLOR WINAPI d3drm_frame3_GetSceneBackground(IDirect3DRMFrame3 *iface) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p.\n", iface); + + return frame->scenebackground; +} + +static D3DCOLOR WINAPI d3drm_frame2_GetSceneBackground(IDirect3DRMFrame2 *iface) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_frame3_GetSceneBackground(&frame->IDirect3DRMFrame3_iface); +} + +static D3DCOLOR WINAPI d3drm_frame1_GetSceneBackground(IDirect3DRMFrame *iface) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_frame3_GetSceneBackground(&frame->IDirect3DRMFrame3_iface); +} + +static HRESULT WINAPI d3drm_frame3_GetSceneBackgroundDepth(IDirect3DRMFrame3 *iface, + IDirectDrawSurface **surface) +{ + FIXME("iface %p, surface %p stub!\n", iface, surface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_GetSceneBackgroundDepth(IDirect3DRMFrame2 *iface, + IDirectDrawSurface **surface) +{ + FIXME("iface %p, surface %p stub!\n", iface, surface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_GetSceneBackgroundDepth(IDirect3DRMFrame *iface, + IDirectDrawSurface **surface) +{ + FIXME("iface %p, surface %p stub!\n", iface, surface); + + return E_NOTIMPL; +} + +static D3DCOLOR WINAPI d3drm_frame3_GetSceneFogColor(IDirect3DRMFrame3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return 0; +} + +static D3DCOLOR WINAPI d3drm_frame2_GetSceneFogColor(IDirect3DRMFrame2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return 0; +} + +static D3DCOLOR WINAPI d3drm_frame1_GetSceneFogColor(IDirect3DRMFrame *iface) +{ + FIXME("iface %p stub!\n", iface); + + return 0; +} + +static BOOL WINAPI d3drm_frame3_GetSceneFogEnable(IDirect3DRMFrame3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return FALSE; +} + +static BOOL WINAPI d3drm_frame2_GetSceneFogEnable(IDirect3DRMFrame2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return FALSE; +} + +static BOOL WINAPI d3drm_frame1_GetSceneFogEnable(IDirect3DRMFrame *iface) +{ + FIXME("iface %p stub!\n", iface); + + return FALSE; +} + +static D3DRMFOGMODE WINAPI d3drm_frame3_GetSceneFogMode(IDirect3DRMFrame3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRMFOG_LINEAR; +} + +static D3DRMFOGMODE WINAPI d3drm_frame2_GetSceneFogMode(IDirect3DRMFrame2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRMFOG_LINEAR; +} + +static D3DRMFOGMODE WINAPI d3drm_frame1_GetSceneFogMode(IDirect3DRMFrame *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRMFOG_LINEAR; +} + +static HRESULT WINAPI d3drm_frame3_GetSceneFogParams(IDirect3DRMFrame3 *iface, + D3DVALUE *start, D3DVALUE *end, D3DVALUE *density) +{ + FIXME("iface %p, start %p, end %p, density %p stub!\n", iface, start, end, density); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_GetSceneFogParams(IDirect3DRMFrame2 *iface, + D3DVALUE *start, D3DVALUE *end, D3DVALUE *density) +{ + FIXME("iface %p, start %p, end %p, density %p stub!\n", iface, start, end, density); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_GetSceneFogParams(IDirect3DRMFrame *iface, + D3DVALUE *start, D3DVALUE *end, D3DVALUE *density) +{ + FIXME("iface %p, start %p, end %p, density %p stub!\n", iface, start, end, density); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetSceneBackground(IDirect3DRMFrame3 *iface, D3DCOLOR color) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, color 0x%08lx.\n", iface, color); + + frame->scenebackground = color; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_SetSceneBackground(IDirect3DRMFrame2 *iface, D3DCOLOR color) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, color 0x%08lx.\n", iface, color); + + return d3drm_frame3_SetSceneBackground(&frame->IDirect3DRMFrame3_iface, color); +} + +static HRESULT WINAPI d3drm_frame1_SetSceneBackground(IDirect3DRMFrame *iface, D3DCOLOR color) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, color 0x%08lx.\n", iface, color); + + return d3drm_frame3_SetSceneBackground(&frame->IDirect3DRMFrame3_iface, color); +} + +static HRESULT WINAPI d3drm_frame3_SetSceneBackgroundRGB(IDirect3DRMFrame3 *iface, + D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue); + + d3drm_set_color(&frame->scenebackground, red, green, blue, 1.0f); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_SetSceneBackgroundRGB(IDirect3DRMFrame2 *iface, + D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue); + + return d3drm_frame3_SetSceneBackgroundRGB(&frame->IDirect3DRMFrame3_iface, red, green, blue); +} + +static HRESULT WINAPI d3drm_frame1_SetSceneBackgroundRGB(IDirect3DRMFrame *iface, + D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue); + + return d3drm_frame3_SetSceneBackgroundRGB(&frame->IDirect3DRMFrame3_iface, red, green, blue); +} + +static HRESULT WINAPI d3drm_frame3_SetSceneBackgroundDepth(IDirect3DRMFrame3 *iface, + IDirectDrawSurface *surface) +{ + FIXME("iface %p, surface %p stub!\n", iface, surface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetSceneBackgroundDepth(IDirect3DRMFrame2 *iface, + IDirectDrawSurface *surface) +{ + FIXME("iface %p, surface %p stub!\n", iface, surface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetSceneBackgroundDepth(IDirect3DRMFrame *iface, + IDirectDrawSurface *surface) +{ + FIXME("iface %p, surface %p stub!\n", iface, surface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetSceneBackgroundImage(IDirect3DRMFrame3 *iface, + IDirect3DRMTexture3 *texture) +{ + FIXME("iface %p, texture %p stub!\n", iface, texture); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetSceneBackgroundImage(IDirect3DRMFrame2 *iface, + IDirect3DRMTexture *texture) +{ + FIXME("iface %p, texture %p stub!\n", iface, texture); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetSceneBackgroundImage(IDirect3DRMFrame *iface, + IDirect3DRMTexture *texture) +{ + FIXME("iface %p, texture %p stub!\n", iface, texture); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetSceneFogEnable(IDirect3DRMFrame3 *iface, BOOL enable) +{ + FIXME("iface %p, enable %#x stub!\n", iface, enable); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetSceneFogEnable(IDirect3DRMFrame2 *iface, BOOL enable) +{ + FIXME("iface %p, enable %#x stub!\n", iface, enable); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetSceneFogEnable(IDirect3DRMFrame *iface, BOOL enable) +{ + FIXME("iface %p, enable %#x stub!\n", iface, enable); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetSceneFogColor(IDirect3DRMFrame3 *iface, D3DCOLOR color) +{ + FIXME("iface %p, color 0x%08lx stub!\n", iface, color); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetSceneFogColor(IDirect3DRMFrame2 *iface, D3DCOLOR color) +{ + FIXME("iface %p, color 0x%08lx stub!\n", iface, color); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetSceneFogColor(IDirect3DRMFrame *iface, D3DCOLOR color) +{ + FIXME("iface %p, color 0x%08lx stub!\n", iface, color); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetSceneFogMode(IDirect3DRMFrame3 *iface, D3DRMFOGMODE mode) +{ + FIXME("iface %p, mode %#x stub!\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetSceneFogMode(IDirect3DRMFrame2 *iface, D3DRMFOGMODE mode) +{ + FIXME("iface %p, mode %#x stub!\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetSceneFogMode(IDirect3DRMFrame *iface, D3DRMFOGMODE mode) +{ + FIXME("iface %p, mode %#x stub!\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetSceneFogParams(IDirect3DRMFrame3 *iface, + D3DVALUE start, D3DVALUE end, D3DVALUE density) +{ + FIXME("iface %p, start %.8e, end %.8e, density %.8e stub!\n", iface, start, end, density); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetSceneFogParams(IDirect3DRMFrame2 *iface, + D3DVALUE start, D3DVALUE end, D3DVALUE density) +{ + FIXME("iface %p, start %.8e, end %.8e, density %.8e stub!\n", iface, start, end, density); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetSceneFogParams(IDirect3DRMFrame *iface, + D3DVALUE start, D3DVALUE end, D3DVALUE density) +{ + FIXME("iface %p, start %.8e, end %.8e, density %.8e stub!\n", iface, start, end, density); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetColor(IDirect3DRMFrame3 *iface, D3DCOLOR color) +{ + FIXME("iface %p, color 0x%08lx stub!\n", iface, color); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetColor(IDirect3DRMFrame2 *iface, D3DCOLOR color) +{ + FIXME("iface %p, color 0x%08lx stub!\n", iface, color); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetColor(IDirect3DRMFrame *iface, D3DCOLOR color) +{ + FIXME("iface %p, color 0x%08lx stub!\n", iface, color); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetColorRGB(IDirect3DRMFrame3 *iface, + D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + FIXME("iface %p, red %.8e, green %.8e, blue %.8e stub!\n", iface, red, green, blue); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetColorRGB(IDirect3DRMFrame2 *iface, + D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + FIXME("iface %p, red %.8e, green %.8e, blue %.8e stub!\n", iface, red, green, blue); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetColorRGB(IDirect3DRMFrame *iface, + D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + FIXME("iface %p, red %.8e, green %.8e, blue %.8e stub!\n", iface, red, green, blue); + + return E_NOTIMPL; +} + +static D3DRMZBUFFERMODE WINAPI d3drm_frame3_GetZbufferMode(IDirect3DRMFrame3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRMZBUFFER_FROMPARENT; +} + +static D3DRMZBUFFERMODE WINAPI d3drm_frame2_GetZbufferMode(IDirect3DRMFrame2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRMZBUFFER_FROMPARENT; +} + +static D3DRMZBUFFERMODE WINAPI d3drm_frame1_GetZbufferMode(IDirect3DRMFrame *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRMZBUFFER_FROMPARENT; +} + +static HRESULT WINAPI d3drm_frame3_SetMaterialMode(IDirect3DRMFrame3 *iface, D3DRMMATERIALMODE mode) +{ + FIXME("iface %p, mode %#x stub!\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetMaterialMode(IDirect3DRMFrame2 *iface, D3DRMMATERIALMODE mode) +{ + FIXME("iface %p, mode %#x stub!\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetMaterialMode(IDirect3DRMFrame *iface, D3DRMMATERIALMODE mode) +{ + FIXME("iface %p, mode %#x stub!\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetOrientation(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *reference, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz) +{ + FIXME("iface %p, reference %p, dx %.8e, dy %.8e, dz %.8e, ux %.8e, uy %.8e, uz %.8e stub!\n", + iface, reference, dx, dy, dz, ux, uy, uz); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetOrientation(IDirect3DRMFrame2 *iface, IDirect3DRMFrame *reference, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz) +{ + FIXME("iface %p, reference %p, dx %.8e, dy %.8e, dz %.8e, ux %.8e, uy %.8e, uz %.8e stub!\n", + iface, reference, dx, dy, dz, ux, uy, uz); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetOrientation(IDirect3DRMFrame *iface, IDirect3DRMFrame *reference, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz) +{ + FIXME("iface %p, reference %p, dx %.8e, dy %.8e, dz %.8e, ux %.8e, uy %.8e, uz %.8e stub!\n", + iface, reference, dx, dy, dz, ux, uy, uz); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetPosition(IDirect3DRMFrame3 *iface, + IDirect3DRMFrame3 *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e stub!\n", iface, reference, x, y, z); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetPosition(IDirect3DRMFrame2 *iface, + IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e stub!\n", iface, reference, x, y, z); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetPosition(IDirect3DRMFrame *iface, + IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e stub!\n", iface, reference, x, y, z); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetRotation(IDirect3DRMFrame3 *iface, + IDirect3DRMFrame3 *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) +{ + FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, theta %.8e stub!\n", + iface, reference, x, y, z, theta); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetRotation(IDirect3DRMFrame2 *iface, + IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) +{ + FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, theta %.8e stub!\n", + iface, reference, x, y, z, theta); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetRotation(IDirect3DRMFrame *iface, + IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) +{ + FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, theta %.8e stub!\n", + iface, reference, x, y, z, theta); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetSortMode(IDirect3DRMFrame3 *iface, D3DRMSORTMODE mode) +{ + FIXME("iface %p, mode %#x stub!\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetSortMode(IDirect3DRMFrame2 *iface, D3DRMSORTMODE mode) +{ + FIXME("iface %p, mode %#x stub!\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetSortMode(IDirect3DRMFrame *iface, D3DRMSORTMODE mode) +{ + FIXME("iface %p, mode %#x stub!\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetTexture(IDirect3DRMFrame3 *iface, IDirect3DRMTexture3 *texture) +{ + FIXME("iface %p, texture %p stub!\n", iface, texture); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetTexture(IDirect3DRMFrame2 *iface, IDirect3DRMTexture *texture) +{ + FIXME("iface %p, texture %p stub!\n", iface, texture); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetTexture(IDirect3DRMFrame *iface, IDirect3DRMTexture *texture) +{ + FIXME("iface %p, texture %p stub!\n", iface, texture); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetTextureTopology(IDirect3DRMFrame2 *iface, BOOL wrap_u, BOOL wrap_v) +{ + FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetTextureTopology(IDirect3DRMFrame *iface, BOOL wrap_u, BOOL wrap_v) +{ + FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetVelocity(IDirect3DRMFrame3 *iface, + IDirect3DRMFrame3 *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation) +{ + FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, with_rotation %#x.\n", + iface, reference, x, y, z, with_rotation); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetVelocity(IDirect3DRMFrame2 *iface, + IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation) +{ + FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, with_rotation %#x stub!\n", + iface, reference, x, y, z, with_rotation); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetVelocity(IDirect3DRMFrame *iface, + IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation) +{ + FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, with_rotation %#x stub!\n", + iface, reference, x, y, z, with_rotation); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetZbufferMode(IDirect3DRMFrame3 *iface, D3DRMZBUFFERMODE mode) +{ + FIXME("iface %p, mode %#x stub!\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_SetZbufferMode(IDirect3DRMFrame2 *iface, D3DRMZBUFFERMODE mode) +{ + FIXME("iface %p, mode %#x stub!\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame1_SetZbufferMode(IDirect3DRMFrame *iface, D3DRMZBUFFERMODE mode) +{ + FIXME("iface %p, mode %#x stub!\n", iface, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_Transform(IDirect3DRMFrame3 *iface, D3DVECTOR *d, D3DVECTOR *s) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, d %p, s %p.\n", iface, d, s); + + d3drm_vector_transform_affine(d, s, &frame->transform); + while ((frame = frame->parent)) + { + d3drm_vector_transform_affine(d, d, &frame->transform); + } + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame2_Transform(IDirect3DRMFrame2 *iface, D3DVECTOR *d, D3DVECTOR *s) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface); + + TRACE("iface %p, d %p, s %p.\n", iface, d, s); + + return d3drm_frame3_Transform(&frame->IDirect3DRMFrame3_iface, d, s); +} + +static HRESULT WINAPI d3drm_frame1_Transform(IDirect3DRMFrame *iface, D3DVECTOR *d, D3DVECTOR *s) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface); + + TRACE("iface %p, d %p, s %p.\n", iface, d, s); + + return d3drm_frame3_Transform(&frame->IDirect3DRMFrame3_iface, d, s); +} + +static HRESULT WINAPI d3drm_frame2_AddMoveCallback2(IDirect3DRMFrame2 *iface, + D3DRMFRAMEMOVECALLBACK cb, void *ctx, DWORD flags) +{ + FIXME("iface %p, cb %p, ctx %p, flags %#lx stub!\n", iface, cb, ctx, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_GetBox(IDirect3DRMFrame3 *iface, D3DRMBOX *box) +{ + FIXME("iface %p, box %p stub!\n", iface, box); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_GetBox(IDirect3DRMFrame2 *iface, D3DRMBOX *box) +{ + FIXME("iface %p, box %p stub!\n", iface, box); + + return E_NOTIMPL; +} + +static BOOL WINAPI d3drm_frame3_GetBoxEnable(IDirect3DRMFrame3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return FALSE; +} + +static BOOL WINAPI d3drm_frame2_GetBoxEnable(IDirect3DRMFrame2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return FALSE; +} + +static HRESULT WINAPI d3drm_frame3_GetAxes(IDirect3DRMFrame3 *iface, D3DVECTOR *dir, D3DVECTOR *up) +{ + FIXME("iface %p, dir %p, up %p stub!\n", iface, dir, up); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_GetAxes(IDirect3DRMFrame2 *iface, D3DVECTOR *dir, D3DVECTOR *up) +{ + FIXME("iface %p, dir %p, up %p stub!\n", iface, dir, up); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_GetMaterial(IDirect3DRMFrame3 *iface, IDirect3DRMMaterial2 **material) +{ + FIXME("iface %p, material %p stub!\n", iface, material); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_GetMaterial(IDirect3DRMFrame2 *iface, IDirect3DRMMaterial **material) +{ + FIXME("iface %p, material %p stub!\n", iface, material); + + return E_NOTIMPL; +} + +static BOOL WINAPI d3drm_frame3_GetInheritAxes(IDirect3DRMFrame3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return FALSE; +} + +static BOOL WINAPI d3drm_frame2_GetInheritAxes(IDirect3DRMFrame2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return FALSE; +} + +static HRESULT WINAPI d3drm_frame3_GetHierarchyBox(IDirect3DRMFrame3 *iface, D3DRMBOX *box) +{ + FIXME("iface %p, box %p stub!\n", iface, box); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame2_GetHierarchyBox(IDirect3DRMFrame2 *iface, D3DRMBOX *box) +{ + FIXME("iface %p, box %p stub!\n", iface, box); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetBox(IDirect3DRMFrame3 *iface, D3DRMBOX *box) +{ + FIXME("iface %p, box %p stub!\n", iface, box); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetBoxEnable(IDirect3DRMFrame3 *iface, BOOL enable) +{ + FIXME("iface %p, enable %#x stub!\n", iface, enable); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetAxes(IDirect3DRMFrame3 *iface, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz) +{ + FIXME("iface %p, dx %.8e, dy %.8e, dz %.8e, ux %.8e, uy %.8e, uz %.8e stub!\n", + iface, dx, dy, dz, ux, uy, uz); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetInheritAxes(IDirect3DRMFrame3 *iface, BOOL inherit) +{ + FIXME("iface %p, inherit %#x stub!\n", iface, inherit); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetMaterial(IDirect3DRMFrame3 *iface, IDirect3DRMMaterial2 *material) +{ + FIXME("iface %p, material %p stub!\n", iface, material); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetQuaternion(IDirect3DRMFrame3 *iface, + IDirect3DRMFrame3 *reference, D3DRMQUATERNION *q) +{ + FIXME("iface %p, reference %p, q %p stub!\n", iface, reference, q); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_RayPick(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *reference, + D3DRMRAY *ray, DWORD flags, IDirect3DRMPicked2Array **visuals) +{ + FIXME("iface %p, reference %p, ray %p, flags %#lx, visuals %p stub!\n", + iface, reference, ray, flags, visuals); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_Save(IDirect3DRMFrame3 *iface, + const char *filename, D3DRMXOFFORMAT format, D3DRMSAVEOPTIONS flags) +{ + FIXME("iface %p, filename %s, format %#x, flags %#lx stub!\n", + iface, debugstr_a(filename), format, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_TransformVectors(IDirect3DRMFrame3 *iface, + IDirect3DRMFrame3 *reference, DWORD num, D3DVECTOR *dst, D3DVECTOR *src) +{ + FIXME("iface %p, reference %p, num %lu, dst %p, src %p stub!\n", iface, reference, num, dst, src); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_InverseTransformVectors(IDirect3DRMFrame3 *iface, + IDirect3DRMFrame3 *reference, DWORD num, D3DVECTOR *dst, D3DVECTOR *src) +{ + FIXME("iface %p, reference %p, num %lu, dst %p, src %p stub!\n", iface, reference, num, dst, src); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetTraversalOptions(IDirect3DRMFrame3 *iface, DWORD options) +{ + static const DWORD supported_options = D3DRMFRAME_RENDERENABLE | D3DRMFRAME_PICKENABLE; + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, options %#lx.\n", iface, options); + + if (options & ~supported_options) + return D3DRMERR_BADVALUE; + + frame->traversal_options = options; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame3_GetTraversalOptions(IDirect3DRMFrame3 *iface, DWORD *options) +{ + struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface); + + TRACE("iface %p, options %p.\n", iface, options); + + if (!options) + return D3DRMERR_BADVALUE; + + *options = frame->traversal_options; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_frame3_SetSceneFogMethod(IDirect3DRMFrame3 *iface, DWORD flags) +{ + FIXME("iface %p, flags %#lx stub!\n", iface, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_GetSceneFogMethod(IDirect3DRMFrame3 *iface, DWORD *fog_mode) +{ + FIXME("iface %p, fog_mode %p stub!\n", iface, fog_mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_SetMaterialOverride(IDirect3DRMFrame3 *iface, + D3DRMMATERIALOVERRIDE *override) +{ + FIXME("iface %p, override %p stub!\n", iface, override); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_frame3_GetMaterialOverride(IDirect3DRMFrame3 *iface, + D3DRMMATERIALOVERRIDE *override) +{ + FIXME("iface %p, override %p stub!\n", iface, override); + + return E_NOTIMPL; +} + +static const struct IDirect3DRMFrame3Vtbl d3drm_frame3_vtbl = +{ + d3drm_frame3_QueryInterface, + d3drm_frame3_AddRef, + d3drm_frame3_Release, + d3drm_frame3_Clone, + d3drm_frame3_AddDestroyCallback, + d3drm_frame3_DeleteDestroyCallback, + d3drm_frame3_SetAppData, + d3drm_frame3_GetAppData, + d3drm_frame3_SetName, + d3drm_frame3_GetName, + d3drm_frame3_GetClassName, + d3drm_frame3_AddChild, + d3drm_frame3_AddLight, + d3drm_frame3_AddMoveCallback, + d3drm_frame3_AddTransform, + d3drm_frame3_AddTranslation, + d3drm_frame3_AddScale, + d3drm_frame3_AddRotation, + d3drm_frame3_AddVisual, + d3drm_frame3_GetChildren, + d3drm_frame3_GetColor, + d3drm_frame3_GetLights, + d3drm_frame3_GetMaterialMode, + d3drm_frame3_GetParent, + d3drm_frame3_GetPosition, + d3drm_frame3_GetRotation, + d3drm_frame3_GetScene, + d3drm_frame3_GetSortMode, + d3drm_frame3_GetTexture, + d3drm_frame3_GetTransform, + d3drm_frame3_GetVelocity, + d3drm_frame3_GetOrientation, + d3drm_frame3_GetVisuals, + d3drm_frame3_InverseTransform, + d3drm_frame3_Load, + d3drm_frame3_LookAt, + d3drm_frame3_Move, + d3drm_frame3_DeleteChild, + d3drm_frame3_DeleteLight, + d3drm_frame3_DeleteMoveCallback, + d3drm_frame3_DeleteVisual, + d3drm_frame3_GetSceneBackground, + d3drm_frame3_GetSceneBackgroundDepth, + d3drm_frame3_GetSceneFogColor, + d3drm_frame3_GetSceneFogEnable, + d3drm_frame3_GetSceneFogMode, + d3drm_frame3_GetSceneFogParams, + d3drm_frame3_SetSceneBackground, + d3drm_frame3_SetSceneBackgroundRGB, + d3drm_frame3_SetSceneBackgroundDepth, + d3drm_frame3_SetSceneBackgroundImage, + d3drm_frame3_SetSceneFogEnable, + d3drm_frame3_SetSceneFogColor, + d3drm_frame3_SetSceneFogMode, + d3drm_frame3_SetSceneFogParams, + d3drm_frame3_SetColor, + d3drm_frame3_SetColorRGB, + d3drm_frame3_GetZbufferMode, + d3drm_frame3_SetMaterialMode, + d3drm_frame3_SetOrientation, + d3drm_frame3_SetPosition, + d3drm_frame3_SetRotation, + d3drm_frame3_SetSortMode, + d3drm_frame3_SetTexture, + d3drm_frame3_SetVelocity, + d3drm_frame3_SetZbufferMode, + d3drm_frame3_Transform, + d3drm_frame3_GetBox, + d3drm_frame3_GetBoxEnable, + d3drm_frame3_GetAxes, + d3drm_frame3_GetMaterial, + d3drm_frame3_GetInheritAxes, + d3drm_frame3_GetHierarchyBox, + d3drm_frame3_SetBox, + d3drm_frame3_SetBoxEnable, + d3drm_frame3_SetAxes, + d3drm_frame3_SetInheritAxes, + d3drm_frame3_SetMaterial, + d3drm_frame3_SetQuaternion, + d3drm_frame3_RayPick, + d3drm_frame3_Save, + d3drm_frame3_TransformVectors, + d3drm_frame3_InverseTransformVectors, + d3drm_frame3_SetTraversalOptions, + d3drm_frame3_GetTraversalOptions, + d3drm_frame3_SetSceneFogMethod, + d3drm_frame3_GetSceneFogMethod, + d3drm_frame3_SetMaterialOverride, + d3drm_frame3_GetMaterialOverride, +}; + +static const struct IDirect3DRMFrame2Vtbl d3drm_frame2_vtbl = +{ + d3drm_frame2_QueryInterface, + d3drm_frame2_AddRef, + d3drm_frame2_Release, + d3drm_frame2_Clone, + d3drm_frame2_AddDestroyCallback, + d3drm_frame2_DeleteDestroyCallback, + d3drm_frame2_SetAppData, + d3drm_frame2_GetAppData, + d3drm_frame2_SetName, + d3drm_frame2_GetName, + d3drm_frame2_GetClassName, + d3drm_frame2_AddChild, + d3drm_frame2_AddLight, + d3drm_frame2_AddMoveCallback, + d3drm_frame2_AddTransform, + d3drm_frame2_AddTranslation, + d3drm_frame2_AddScale, + d3drm_frame2_AddRotation, + d3drm_frame2_AddVisual, + d3drm_frame2_GetChildren, + d3drm_frame2_GetColor, + d3drm_frame2_GetLights, + d3drm_frame2_GetMaterialMode, + d3drm_frame2_GetParent, + d3drm_frame2_GetPosition, + d3drm_frame2_GetRotation, + d3drm_frame2_GetScene, + d3drm_frame2_GetSortMode, + d3drm_frame2_GetTexture, + d3drm_frame2_GetTransform, + d3drm_frame2_GetVelocity, + d3drm_frame2_GetOrientation, + d3drm_frame2_GetVisuals, + d3drm_frame2_GetTextureTopology, + d3drm_frame2_InverseTransform, + d3drm_frame2_Load, + d3drm_frame2_LookAt, + d3drm_frame2_Move, + d3drm_frame2_DeleteChild, + d3drm_frame2_DeleteLight, + d3drm_frame2_DeleteMoveCallback, + d3drm_frame2_DeleteVisual, + d3drm_frame2_GetSceneBackground, + d3drm_frame2_GetSceneBackgroundDepth, + d3drm_frame2_GetSceneFogColor, + d3drm_frame2_GetSceneFogEnable, + d3drm_frame2_GetSceneFogMode, + d3drm_frame2_GetSceneFogParams, + d3drm_frame2_SetSceneBackground, + d3drm_frame2_SetSceneBackgroundRGB, + d3drm_frame2_SetSceneBackgroundDepth, + d3drm_frame2_SetSceneBackgroundImage, + d3drm_frame2_SetSceneFogEnable, + d3drm_frame2_SetSceneFogColor, + d3drm_frame2_SetSceneFogMode, + d3drm_frame2_SetSceneFogParams, + d3drm_frame2_SetColor, + d3drm_frame2_SetColorRGB, + d3drm_frame2_GetZbufferMode, + d3drm_frame2_SetMaterialMode, + d3drm_frame2_SetOrientation, + d3drm_frame2_SetPosition, + d3drm_frame2_SetRotation, + d3drm_frame2_SetSortMode, + d3drm_frame2_SetTexture, + d3drm_frame2_SetTextureTopology, + d3drm_frame2_SetVelocity, + d3drm_frame2_SetZbufferMode, + d3drm_frame2_Transform, + d3drm_frame2_AddMoveCallback2, + d3drm_frame2_GetBox, + d3drm_frame2_GetBoxEnable, + d3drm_frame2_GetAxes, + d3drm_frame2_GetMaterial, + d3drm_frame2_GetInheritAxes, + d3drm_frame2_GetHierarchyBox, +}; + +static const struct IDirect3DRMFrameVtbl d3drm_frame1_vtbl = +{ + d3drm_frame1_QueryInterface, + d3drm_frame1_AddRef, + d3drm_frame1_Release, + d3drm_frame1_Clone, + d3drm_frame1_AddDestroyCallback, + d3drm_frame1_DeleteDestroyCallback, + d3drm_frame1_SetAppData, + d3drm_frame1_GetAppData, + d3drm_frame1_SetName, + d3drm_frame1_GetName, + d3drm_frame1_GetClassName, + d3drm_frame1_AddChild, + d3drm_frame1_AddLight, + d3drm_frame1_AddMoveCallback, + d3drm_frame1_AddTransform, + d3drm_frame1_AddTranslation, + d3drm_frame1_AddScale, + d3drm_frame1_AddRotation, + d3drm_frame1_AddVisual, + d3drm_frame1_GetChildren, + d3drm_frame1_GetColor, + d3drm_frame1_GetLights, + d3drm_frame1_GetMaterialMode, + d3drm_frame1_GetParent, + d3drm_frame1_GetPosition, + d3drm_frame1_GetRotation, + d3drm_frame1_GetScene, + d3drm_frame1_GetSortMode, + d3drm_frame1_GetTexture, + d3drm_frame1_GetTransform, + d3drm_frame1_GetVelocity, + d3drm_frame1_GetOrientation, + d3drm_frame1_GetVisuals, + d3drm_frame1_GetTextureTopology, + d3drm_frame1_InverseTransform, + d3drm_frame1_Load, + d3drm_frame1_LookAt, + d3drm_frame1_Move, + d3drm_frame1_DeleteChild, + d3drm_frame1_DeleteLight, + d3drm_frame1_DeleteMoveCallback, + d3drm_frame1_DeleteVisual, + d3drm_frame1_GetSceneBackground, + d3drm_frame1_GetSceneBackgroundDepth, + d3drm_frame1_GetSceneFogColor, + d3drm_frame1_GetSceneFogEnable, + d3drm_frame1_GetSceneFogMode, + d3drm_frame1_GetSceneFogParams, + d3drm_frame1_SetSceneBackground, + d3drm_frame1_SetSceneBackgroundRGB, + d3drm_frame1_SetSceneBackgroundDepth, + d3drm_frame1_SetSceneBackgroundImage, + d3drm_frame1_SetSceneFogEnable, + d3drm_frame1_SetSceneFogColor, + d3drm_frame1_SetSceneFogMode, + d3drm_frame1_SetSceneFogParams, + d3drm_frame1_SetColor, + d3drm_frame1_SetColorRGB, + d3drm_frame1_GetZbufferMode, + d3drm_frame1_SetMaterialMode, + d3drm_frame1_SetOrientation, + d3drm_frame1_SetPosition, + d3drm_frame1_SetRotation, + d3drm_frame1_SetSortMode, + d3drm_frame1_SetTexture, + d3drm_frame1_SetTextureTopology, + d3drm_frame1_SetVelocity, + d3drm_frame1_SetZbufferMode, + d3drm_frame1_Transform, +}; + +struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface) +{ + if (!iface) + return NULL; + assert(iface->lpVtbl == &d3drm_frame3_vtbl); + + return impl_from_IDirect3DRMFrame3(iface); +} + +struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame(IDirect3DRMFrame *iface) +{ + if (!iface) + return NULL; + assert(iface->lpVtbl == &d3drm_frame1_vtbl); + + return impl_from_IDirect3DRMFrame(iface); +} + +HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, IDirect3DRM *d3drm) +{ + static const char classname[] = "Frame"; + struct d3drm_frame *object; + HRESULT hr = D3DRM_OK; + + TRACE("frame %p, parent_frame %p, d3drm %p.\n", frame, parent_frame, d3drm); + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IDirect3DRMFrame_iface.lpVtbl = &d3drm_frame1_vtbl; + object->IDirect3DRMFrame2_iface.lpVtbl = &d3drm_frame2_vtbl; + object->IDirect3DRMFrame3_iface.lpVtbl = &d3drm_frame3_vtbl; + object->d3drm = d3drm; + object->ref = 1; + d3drm_set_color(&object->scenebackground, 0.0f, 0.0f, 0.0f, 1.0f); + object->traversal_options = D3DRMFRAME_RENDERENABLE | D3DRMFRAME_PICKENABLE; + + d3drm_object_init(&object->obj, classname); + + object->transform = identity; + + if (parent_frame) + { + IDirect3DRMFrame3 *p; + + if (FAILED(hr = IDirect3DRMFrame_QueryInterface(parent_frame, &IID_IDirect3DRMFrame3, (void **)&p))) + { + free(object); + return hr; + } + IDirect3DRMFrame_Release(parent_frame); + IDirect3DRMFrame3_AddChild(p, &object->IDirect3DRMFrame3_iface); + } + + IDirect3DRM_AddRef(object->d3drm); + + *frame = object; + + return hr; +} + +static HRESULT WINAPI d3drm_animation2_QueryInterface(IDirect3DRMAnimation2 *iface, REFIID riid, void **out) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRMAnimation) + || IsEqualGUID(riid, &IID_IDirect3DRMObject) + || IsEqualGUID(riid, &IID_IUnknown)) + { + *out = &animation->IDirect3DRMAnimation_iface; + } + else if (IsEqualGUID(riid, &IID_IDirect3DRMAnimation2)) + { + *out = &animation->IDirect3DRMAnimation2_iface; + } + else + { + *out = NULL; + WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid)); + return CLASS_E_CLASSNOTAVAILABLE; + } + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} + +static HRESULT WINAPI d3drm_animation1_QueryInterface(IDirect3DRMAnimation *iface, REFIID riid, void **out) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + return IDirect3DRMAnimation2_QueryInterface(&animation->IDirect3DRMAnimation2_iface, riid, out); +} + +static ULONG WINAPI d3drm_animation2_AddRef(IDirect3DRMAnimation2 *iface) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + ULONG refcount = InterlockedIncrement(&animation->ref); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI d3drm_animation1_AddRef(IDirect3DRMAnimation *iface) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + return IDirect3DRMAnimation2_AddRef(&animation->IDirect3DRMAnimation2_iface); +} + +static ULONG WINAPI d3drm_animation2_Release(IDirect3DRMAnimation2 *iface) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + ULONG refcount = InterlockedDecrement(&animation->ref); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + { + d3drm_object_cleanup((IDirect3DRMObject *)&animation->IDirect3DRMAnimation_iface, &animation->obj); + IDirect3DRM_Release(animation->d3drm); + free(animation->rotate.keys); + free(animation->scale.keys); + free(animation->position.keys); + free(animation); + } + + return refcount; +} + +static ULONG WINAPI d3drm_animation1_Release(IDirect3DRMAnimation *iface) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + + return IDirect3DRMAnimation2_Release(&animation->IDirect3DRMAnimation2_iface); +} + +static HRESULT WINAPI d3drm_animation2_Clone(IDirect3DRMAnimation2 *iface, IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_animation1_Clone(IDirect3DRMAnimation *iface, IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_animation2_AddDestroyCallback(IDirect3DRMAnimation2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_add_destroy_callback(&animation->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_animation1_AddDestroyCallback(IDirect3DRMAnimation *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return IDirect3DRMAnimation2_AddDestroyCallback(&animation->IDirect3DRMAnimation2_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_animation2_DeleteDestroyCallback(IDirect3DRMAnimation2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_delete_destroy_callback(&animation->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_animation1_DeleteDestroyCallback(IDirect3DRMAnimation *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return IDirect3DRMAnimation2_DeleteDestroyCallback(&animation->IDirect3DRMAnimation2_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_animation2_SetAppData(IDirect3DRMAnimation2 *iface, DWORD data) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + animation->obj.appdata = data; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_animation1_SetAppData(IDirect3DRMAnimation *iface, DWORD data) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + return d3drm_animation2_SetAppData(&animation->IDirect3DRMAnimation2_iface, data); +} + +static DWORD WINAPI d3drm_animation2_GetAppData(IDirect3DRMAnimation2 *iface) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + + TRACE("iface %p.\n", iface); + + return animation->obj.appdata; +} + +static DWORD WINAPI d3drm_animation1_GetAppData(IDirect3DRMAnimation *iface) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_animation2_GetAppData(&animation->IDirect3DRMAnimation2_iface); +} + +static HRESULT WINAPI d3drm_animation2_SetName(IDirect3DRMAnimation2 *iface, const char *name) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_object_set_name(&animation->obj, name); +} + +static HRESULT WINAPI d3drm_animation1_SetName(IDirect3DRMAnimation *iface, const char *name) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_animation2_SetName(&animation->IDirect3DRMAnimation2_iface, name); +} + +static HRESULT WINAPI d3drm_animation2_GetName(IDirect3DRMAnimation2 *iface, DWORD *size, char *name) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_name(&animation->obj, size, name); +} + +static HRESULT WINAPI d3drm_animation1_GetName(IDirect3DRMAnimation *iface, DWORD *size, char *name) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_animation2_GetName(&animation->IDirect3DRMAnimation2_iface, size, name); +} + +static HRESULT WINAPI d3drm_animation2_GetClassName(IDirect3DRMAnimation2 *iface, DWORD *size, char *name) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_class_name(&animation->obj, size, name); +} + +static HRESULT WINAPI d3drm_animation1_GetClassName(IDirect3DRMAnimation *iface, DWORD *size, char *name) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_animation2_GetClassName(&animation->IDirect3DRMAnimation2_iface, size, name); +} + +static HRESULT WINAPI d3drm_animation2_SetOptions(IDirect3DRMAnimation2 *iface, D3DRMANIMATIONOPTIONS options) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + static const DWORD supported_options = D3DRMANIMATION_OPEN | D3DRMANIMATION_CLOSED | D3DRMANIMATION_LINEARPOSITION + | D3DRMANIMATION_SPLINEPOSITION | D3DRMANIMATION_SCALEANDROTATION | D3DRMANIMATION_POSITION; + + TRACE("iface %p, options %#lx.\n", iface, options); + + if (!(options & supported_options)) + return D3DRMERR_BADVALUE; + + if ((options & (D3DRMANIMATION_OPEN | D3DRMANIMATION_CLOSED)) == (D3DRMANIMATION_OPEN | D3DRMANIMATION_CLOSED) || + (options & (D3DRMANIMATION_LINEARPOSITION | D3DRMANIMATION_SPLINEPOSITION)) == + (D3DRMANIMATION_LINEARPOSITION | D3DRMANIMATION_SPLINEPOSITION) || + (options & (D3DRMANIMATION_SCALEANDROTATION | D3DRMANIMATION_POSITION)) == + (D3DRMANIMATION_SCALEANDROTATION | D3DRMANIMATION_POSITION)) + { + return D3DRMERR_BADVALUE; + } + + animation->options = options; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_animation1_SetOptions(IDirect3DRMAnimation *iface, D3DRMANIMATIONOPTIONS options) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + + TRACE("iface %p, %#lx.\n", iface, options); + + return d3drm_animation2_SetOptions(&animation->IDirect3DRMAnimation2_iface, options); +} + +static SIZE_T d3drm_animation_lookup_key(const struct d3drm_animation_key *keys, + SIZE_T count, D3DVALUE time) +{ + SIZE_T start = 0, cur = 0, end = count; + + while (start < end) + { + cur = start + (end - start) / 2; + + if (time == keys[cur].time) + return cur; + + if (time < keys[cur].time) + end = cur; + else + start = cur + 1; + } + + return cur; +} + +static SIZE_T d3drm_animation_get_index_min(const struct d3drm_animation_key *keys, SIZE_T count, D3DVALUE time) +{ + SIZE_T i; + + i = d3drm_animation_lookup_key(keys, count, time); + while (i > 0 && keys[i - 1].time == time) + --i; + + return i; +} + +static SIZE_T d3drm_animation_get_index_max(const struct d3drm_animation_key *keys, SIZE_T count, D3DVALUE time) +{ + SIZE_T i; + + i = d3drm_animation_lookup_key(keys, count, time); + while (i < count - 1 && keys[i + 1].time == time) + ++i; + + return i; +} + +static SIZE_T d3drm_animation_get_insert_position(const struct d3drm_animation_keys *keys, D3DVALUE time) +{ + if (!keys->count || time < keys->keys[0].time) + return 0; + + if (time >= keys->keys[keys->count - 1].time) + return keys->count; + + return d3drm_animation_get_index_max(keys->keys, keys->count, time); +} + +static const struct d3drm_animation_key *d3drm_animation_get_range(const struct d3drm_animation_keys *keys, + D3DVALUE time_min, D3DVALUE time_max, SIZE_T *count) +{ + SIZE_T min; + + if (!keys->count || time_max < keys->keys[0].time + || time_min > keys->keys[keys->count - 1].time) + return NULL; + + min = d3drm_animation_get_index_min(keys->keys, keys->count, time_min); + if (count) + *count = d3drm_animation_get_index_max(&keys->keys[min], keys->count - min, time_max) - min + 1; + + return &keys->keys[min]; +} + +static HRESULT WINAPI d3drm_animation2_AddKey(IDirect3DRMAnimation2 *iface, D3DRMANIMATIONKEY *key) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + struct d3drm_animation_keys *keys; + SIZE_T index; + + TRACE("iface %p, key %p.\n", iface, key); + + if (!key || key->dwSize != sizeof(*key)) + return E_INVALIDARG; + + switch (key->dwKeyType) + { + case D3DRMANIMATION_POSITIONKEY: + keys = &animation->position; + break; + case D3DRMANIMATION_SCALEKEY: + keys = &animation->scale; + break; + case D3DRMANIMATION_ROTATEKEY: + keys = &animation->rotate; + break; + default: + return E_INVALIDARG; + } + + index = d3drm_animation_get_insert_position(keys, key->dvTime); + + if (!d3drm_array_reserve((void **)&keys->keys, &keys->size, keys->count + 1, sizeof(*keys->keys))) + return E_OUTOFMEMORY; + + if (index < keys->count) + memmove(&keys->keys[index + 1], &keys->keys[index], sizeof(*keys->keys) * (keys->count - index)); + keys->keys[index].time = key->dvTime; + switch (key->dwKeyType) + { + case D3DRMANIMATION_POSITIONKEY: + keys->keys[index].u.position = key->dvPositionKey; + break; + case D3DRMANIMATION_SCALEKEY: + keys->keys[index].u.scale = key->dvScaleKey; + break; + case D3DRMANIMATION_ROTATEKEY: + keys->keys[index].u.rotate = key->dqRotateKey; + break; + } + ++keys->count; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_animation2_AddRotateKey(IDirect3DRMAnimation2 *iface, D3DVALUE time, D3DRMQUATERNION *q) +{ + D3DRMANIMATIONKEY key; + + TRACE("iface %p, time %.8e, q %p.\n", iface, time, q); + + key.dwSize = sizeof(key); + key.dwKeyType = D3DRMANIMATION_ROTATEKEY; + key.dvTime = time; + key.dwID = 0; + key.dqRotateKey = *q; + + return d3drm_animation2_AddKey(iface, &key); +} + +static HRESULT WINAPI d3drm_animation1_AddRotateKey(IDirect3DRMAnimation *iface, D3DVALUE time, D3DRMQUATERNION *q) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + + TRACE("iface %p, time %.8e, q %p.\n", iface, time, q); + + return d3drm_animation2_AddRotateKey(&animation->IDirect3DRMAnimation2_iface, time, q); +} + +static HRESULT WINAPI d3drm_animation2_AddPositionKey(IDirect3DRMAnimation2 *iface, D3DVALUE time, + D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + D3DRMANIMATIONKEY key; + + TRACE("iface %p, time %.8e, x %.8e, y %.8e, z %.8e.\n", iface, time, x, y, z); + + key.dwSize = sizeof(key); + key.dwKeyType = D3DRMANIMATION_POSITIONKEY; + key.dvTime = time; + key.dwID = 0; + key.dvPositionKey.x = x; + key.dvPositionKey.y = y; + key.dvPositionKey.z = z; + + return d3drm_animation2_AddKey(iface, &key); +} + +static HRESULT WINAPI d3drm_animation1_AddPositionKey(IDirect3DRMAnimation *iface, D3DVALUE time, + D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + + TRACE("iface %p, time %.8e, x %.8e, y %.8e, z %.8e.\n", iface, time, x, y, z); + + return d3drm_animation2_AddPositionKey(&animation->IDirect3DRMAnimation2_iface, time, x, y, z); +} + +static HRESULT WINAPI d3drm_animation2_AddScaleKey(IDirect3DRMAnimation2 *iface, D3DVALUE time, + D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + D3DRMANIMATIONKEY key; + + TRACE("iface %p, time %.8e, x %.8e, y %.8e, z %.8e.\n", iface, time, x, y, z); + + key.dwSize = sizeof(key); + key.dwKeyType = D3DRMANIMATION_SCALEKEY; + key.dvTime = time; + key.dwID = 0; + key.dvScaleKey.x = x; + key.dvScaleKey.y = y; + key.dvScaleKey.z = z; + + return d3drm_animation2_AddKey(iface, &key); +} + +static HRESULT WINAPI d3drm_animation1_AddScaleKey(IDirect3DRMAnimation *iface, D3DVALUE time, + D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + + TRACE("iface %p, time %.8e, x %.8e, y %.8e, z %.8e.\n", iface, time, x, y, z); + + return d3drm_animation2_AddScaleKey(&animation->IDirect3DRMAnimation2_iface, time, x, y, z); +} + +static void d3drm_animation_delete_key(struct d3drm_animation_keys *keys, const struct d3drm_animation_key *key) +{ + SIZE_T index = key - keys->keys; + + if (index < keys->count - 1) + memmove(&keys->keys[index], &keys->keys[index + 1], sizeof(*keys->keys) * (keys->count - index - 1)); + --keys->count; +} + +static HRESULT WINAPI d3drm_animation2_DeleteKey(IDirect3DRMAnimation2 *iface, D3DVALUE time) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + const struct d3drm_animation_key *key; + + TRACE("iface %p, time %.8e.\n", iface, time); + + if ((key = d3drm_animation_get_range(&animation->rotate, time, time, NULL))) + d3drm_animation_delete_key(&animation->rotate, key); + + if ((key = d3drm_animation_get_range(&animation->position, time, time, NULL))) + d3drm_animation_delete_key(&animation->position, key); + + if ((key = d3drm_animation_get_range(&animation->scale, time, time, NULL))) + d3drm_animation_delete_key(&animation->scale, key); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_animation1_DeleteKey(IDirect3DRMAnimation *iface, D3DVALUE time) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + + TRACE("iface %p, time %.8e.\n", iface, time); + + return d3drm_animation2_DeleteKey(&animation->IDirect3DRMAnimation2_iface, time); +} + +static HRESULT WINAPI d3drm_animation1_SetFrame(IDirect3DRMAnimation *iface, IDirect3DRMFrame *frame) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + HRESULT hr = D3DRM_OK; + + TRACE("iface %p, frame %p.\n", iface, frame); + + if (frame) + { + hr = IDirect3DRMFrame_QueryInterface(frame, &IID_IDirect3DRMFrame3, (void **)&animation->frame); + if (SUCCEEDED(hr)) + IDirect3DRMFrame3_Release(animation->frame); + } + else + animation->frame = NULL; + + return hr; +} + +static HRESULT WINAPI d3drm_animation1_SetTime(IDirect3DRMAnimation *iface, D3DVALUE time) +{ + FIXME("iface %p, time %.8e.\n", iface, time); + + return E_NOTIMPL; +} + +static D3DRMANIMATIONOPTIONS WINAPI d3drm_animation2_GetOptions(IDirect3DRMAnimation2 *iface) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + + TRACE("iface %p.\n", iface); + + return animation->options; +} + +static D3DRMANIMATIONOPTIONS WINAPI d3drm_animation1_GetOptions(IDirect3DRMAnimation *iface) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_animation2_GetOptions(&animation->IDirect3DRMAnimation2_iface); +} + +static HRESULT WINAPI d3drm_animation2_SetFrame(IDirect3DRMAnimation2 *iface, IDirect3DRMFrame3 *frame) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + + TRACE("iface %p, frame %p.\n", iface, frame); + + animation->frame = frame; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_animation2_SetTime(IDirect3DRMAnimation2 *iface, D3DVALUE time) +{ + FIXME("iface %p, time %.8e.\n", iface, time); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_animation2_GetFrame(IDirect3DRMAnimation2 *iface, IDirect3DRMFrame3 **frame) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + + TRACE("iface %p, frame %p.\n", iface, frame); + + if (!frame) + return D3DRMERR_BADVALUE; + + *frame = animation->frame; + if (*frame) + IDirect3DRMFrame3_AddRef(*frame); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_animation2_DeleteKeyByID(IDirect3DRMAnimation2 *iface, DWORD id) +{ + FIXME("iface %p, id %#lx.\n", iface, id); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_animation2_ModifyKey(IDirect3DRMAnimation2 *iface, D3DRMANIMATIONKEY *key) +{ + FIXME("iface %p, key %p.\n", iface, key); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_animation2_GetKeys(IDirect3DRMAnimation2 *iface, D3DVALUE time_min, D3DVALUE time_max, + DWORD *key_count, D3DRMANIMATIONKEY *keys) +{ + struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface); + const struct d3drm_animation_key *key; + SIZE_T count, i; + + TRACE("iface %p, time min %.8e, time max %.8e, key_count %p, keys %p.\n", + iface, time_min, time_max, key_count, keys); + + if (!key_count) + return D3DRMERR_BADVALUE; + + *key_count = 0; + + if ((key = d3drm_animation_get_range(&animation->rotate, time_min, time_max, &count))) + { + if (keys) + { + for (i = 0; i < count; ++i) + { + keys[i].dwSize = sizeof(*keys); + keys[i].dwKeyType = D3DRMANIMATION_ROTATEKEY; + keys[i].dvTime = key[i].time; + keys[i].dwID = 0; /* FIXME */ + keys[i].dqRotateKey = key[i].u.rotate; + } + keys += count; + } + *key_count += count; + } + + if ((key = d3drm_animation_get_range(&animation->position, time_min, time_max, &count))) + { + if (keys) + { + for (i = 0; i < count; ++i) + { + keys[i].dwSize = sizeof(*keys); + keys[i].dwKeyType = D3DRMANIMATION_POSITIONKEY; + keys[i].dvTime = key[i].time; + keys[i].dwID = 0; /* FIXME */ + keys[i].dvPositionKey = key[i].u.position; + } + keys += count; + } + *key_count += count; + } + + if ((key = d3drm_animation_get_range(&animation->scale, time_min, time_max, &count))) + { + if (keys) + { + for (i = 0; keys && i < count; ++i) + { + keys[i].dwSize = sizeof(*keys); + keys[i].dwKeyType = D3DRMANIMATION_SCALEKEY; + keys[i].dvTime = key[i].time; + keys[i].dwID = 0; /* FIXME */ + keys[i].dvScaleKey = key[i].u.scale; + } + keys += count; + } + *key_count += count; + } + + return *key_count ? D3DRM_OK : D3DRMERR_NOSUCHKEY; +} + +static const struct IDirect3DRMAnimationVtbl d3drm_animation1_vtbl = +{ + d3drm_animation1_QueryInterface, + d3drm_animation1_AddRef, + d3drm_animation1_Release, + d3drm_animation1_Clone, + d3drm_animation1_AddDestroyCallback, + d3drm_animation1_DeleteDestroyCallback, + d3drm_animation1_SetAppData, + d3drm_animation1_GetAppData, + d3drm_animation1_SetName, + d3drm_animation1_GetName, + d3drm_animation1_GetClassName, + d3drm_animation1_SetOptions, + d3drm_animation1_AddRotateKey, + d3drm_animation1_AddPositionKey, + d3drm_animation1_AddScaleKey, + d3drm_animation1_DeleteKey, + d3drm_animation1_SetFrame, + d3drm_animation1_SetTime, + d3drm_animation1_GetOptions, +}; + +static const struct IDirect3DRMAnimation2Vtbl d3drm_animation2_vtbl = +{ + d3drm_animation2_QueryInterface, + d3drm_animation2_AddRef, + d3drm_animation2_Release, + d3drm_animation2_Clone, + d3drm_animation2_AddDestroyCallback, + d3drm_animation2_DeleteDestroyCallback, + d3drm_animation2_SetAppData, + d3drm_animation2_GetAppData, + d3drm_animation2_SetName, + d3drm_animation2_GetName, + d3drm_animation2_GetClassName, + d3drm_animation2_SetOptions, + d3drm_animation2_AddRotateKey, + d3drm_animation2_AddPositionKey, + d3drm_animation2_AddScaleKey, + d3drm_animation2_DeleteKey, + d3drm_animation2_SetFrame, + d3drm_animation2_SetTime, + d3drm_animation2_GetOptions, + d3drm_animation2_GetFrame, + d3drm_animation2_DeleteKeyByID, + d3drm_animation2_AddKey, + d3drm_animation2_ModifyKey, + d3drm_animation2_GetKeys, +}; + +HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *d3drm) +{ + static const char classname[] = "Animation"; + struct d3drm_animation *object; + HRESULT hr = D3DRM_OK; + + TRACE("animation %p, d3drm %p.\n", animation, d3drm); + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IDirect3DRMAnimation_iface.lpVtbl = &d3drm_animation1_vtbl; + object->IDirect3DRMAnimation2_iface.lpVtbl = &d3drm_animation2_vtbl; + object->d3drm = d3drm; + object->ref = 1; + object->options = D3DRMANIMATION_CLOSED | D3DRMANIMATION_LINEARPOSITION; + + d3drm_object_init(&object->obj, classname); + + IDirect3DRM_AddRef(object->d3drm); + + *animation = object; + + return hr; +} diff --git a/3rdparty/d3drm/include/d3drm.h b/3rdparty/d3drm/include/d3drm.h new file mode 100644 index 00000000..c10b9ed1 --- /dev/null +++ b/3rdparty/d3drm/include/d3drm.h @@ -0,0 +1,524 @@ +/* + * Copyright (C) 2005 Peter Berg Larsen + * Copyright (C) 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_H__ +#define __D3DRM_H__ + +#include + +typedef struct IDirect3DRM *LPDIRECT3DRM, **LPLPDIRECT3DRM; + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Direct3DRM Object CLSID */ +DEFINE_GUID(CLSID_CDirect3DRM, 0x4516ec41, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); + +/* Direct3DRM Interface GUIDs */ +DEFINE_GUID(IID_IDirect3DRM, 0x2bc49361, 0x8327, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRM2, 0x4516ecc8, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRM3, 0x4516ec83, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); + +typedef struct IDirect3DRM2 *LPDIRECT3DRM2, **LPLPDIRECT3DRM2; +typedef struct IDirect3DRM3 *LPDIRECT3DRM3, **LPLPDIRECT3DRM3; + +HRESULT WINAPI Direct3DRMCreate(struct IDirect3DRM **d3drm); + +/***************************************************************************** + * IDirect3DRMObject interface + */ +#ifdef WINE_NO_UNICODE_MACROS +#undef GetClassName +#endif +#define INTERFACE IDirect3DRM +DECLARE_INTERFACE_(IDirect3DRM,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRM methods ***/ + STDMETHOD(CreateObject)(THIS_ REFCLSID clsid, IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(CreateFrame)(THIS_ IDirect3DRMFrame *parent, IDirect3DRMFrame **frame) PURE; + STDMETHOD(CreateMesh)(THIS_ IDirect3DRMMesh **mesh) PURE; + STDMETHOD(CreateMeshBuilder)(THIS_ IDirect3DRMMeshBuilder **mesh_builder) PURE; + STDMETHOD(CreateFace)(THIS_ IDirect3DRMFace **face) PURE; + STDMETHOD(CreateAnimation)(THIS_ IDirect3DRMAnimation **animation) PURE; + STDMETHOD(CreateAnimationSet)(THIS_ IDirect3DRMAnimationSet **set) PURE; + STDMETHOD(CreateTexture)(THIS_ D3DRMIMAGE *image, IDirect3DRMTexture **texture) PURE; + STDMETHOD(CreateLight)(THIS_ D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light) PURE; + STDMETHOD(CreateLightRGB)(THIS_ D3DRMLIGHTTYPE type, D3DVALUE r, D3DVALUE g, D3DVALUE b, + IDirect3DRMLight **light) PURE; + STDMETHOD(CreateMaterial)(THIS_ D3DVALUE power, IDirect3DRMMaterial **material) PURE; + STDMETHOD(CreateDevice)(THIS_ DWORD width, DWORD height, IDirect3DRMDevice **device) PURE; + STDMETHOD(CreateDeviceFromSurface)(THIS_ GUID *guid, IDirectDraw *ddraw, + IDirectDrawSurface *surface, IDirect3DRMDevice **device) PURE; + STDMETHOD(CreateDeviceFromD3D)(THIS_ IDirect3D *d3d, IDirect3DDevice *d3d_device, + IDirect3DRMDevice **device) PURE; + STDMETHOD(CreateDeviceFromClipper)(THIS_ IDirectDrawClipper *clipper, GUID *guid, + int width, int height, IDirect3DRMDevice **device) PURE; + STDMETHOD(CreateTextureFromSurface)(THIS_ IDirectDrawSurface *surface, + IDirect3DRMTexture **texture) PURE; + STDMETHOD(CreateShadow)(THIS_ IDirect3DRMVisual *visual, IDirect3DRMLight *light, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, + IDirect3DRMVisual **shadow) PURE; + STDMETHOD(CreateViewport)(THIS_ IDirect3DRMDevice *device, IDirect3DRMFrame *camera, + DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport **viewport) PURE; + STDMETHOD(CreateWrap)(THIS_ D3DRMWRAPTYPE type, IDirect3DRMFrame *reference, D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, D3DVALUE ou, D3DVALUE ov, + D3DVALUE su, D3DVALUE sv, IDirect3DRMWrap **wrap) PURE; + STDMETHOD(CreateUserVisual)(THIS_ D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual) PURE; + STDMETHOD(LoadTexture)(THIS_ const char *filename, IDirect3DRMTexture **texture) PURE; + STDMETHOD(LoadTextureFromResource)(THIS_ HRSRC resource, IDirect3DRMTexture **texture) PURE; + STDMETHOD(SetSearchPath)(THIS_ const char *path) PURE; + STDMETHOD(AddSearchPath)(THIS_ const char *path) PURE; + STDMETHOD(GetSearchPath)(THIS_ DWORD *size, char *path) PURE; + STDMETHOD(SetDefaultTextureColors)(THIS_ DWORD) PURE; + STDMETHOD(SetDefaultTextureShades)(THIS_ DWORD) PURE; + STDMETHOD(GetDevices)(THIS_ IDirect3DRMDeviceArray **array) PURE; + STDMETHOD(GetNamedObject)(THIS_ const char *name, IDirect3DRMObject **object) PURE; + STDMETHOD(EnumerateObjects)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(Load)(THIS_ void *source, void *object_id, IID **iids, DWORD iid_count, D3DRMLOADOPTIONS flags, + D3DRMLOADCALLBACK load_cb, void *load_ctx, D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx, + IDirect3DRMFrame *parent_frame) PURE; + STDMETHOD(Tick)(THIS_ D3DVALUE) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRM_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRM_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRM_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRM methods ***/ +#define IDirect3DRM_CreateObject(p,a,b,c,d) (p)->lpVtbl->CreateObject(p,a,b,c,d) +#define IDirect3DRM_CreateFrame(p,a,b) (p)->lpVtbl->CreateFrame(p,a,b) +#define IDirect3DRM_CreateMesh(p,a) (p)->lpVtbl->CreateMesh(p,a) +#define IDirect3DRM_CreateMeshBuilder(p,a) (p)->lpVtbl->CreateMeshBuilder(p,a) +#define IDirect3DRM_CreateFace(p,a) (p)->lpVtbl->CreateFace(p,a) +#define IDirect3DRM_CreateAnimation(p,a) (p)->lpVtbl->CreateAnimation(p,a) +#define IDirect3DRM_CreateAnimationSet(p,a) (p)->lpVtbl->CreateAnimationSet(p,a) +#define IDirect3DRM_CreateTexture(p,a,b) (p)->lpVtbl->CreateTexture(p,a,b) +#define IDirect3DRM_CreateLight(p,a,b,c) (p)->lpVtbl->CreateLight(p,a,b,c) +#define IDirect3DRM_CreateLightRGB(p,a,b,c,d,e) (p)->lpVtbl->CreateLightRGB(p,a,b,c,d,e) +#define IDirect3DRM_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b) +#define IDirect3DRM_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirect3DRM_CreateDeviceFromSurface(p,a,b,c,d) (p)->lpVtbl->CreateDeviceFromSurface(p,a,b,c,d) +#define IDirect3DRM_CreateDeviceFromD3D(p,a,b,c) (p)->lpVtbl->CreateDeviceFromD3D(p,a,b,c) +#define IDirect3DRM_CreateDeviceFromClipper(p,a,b,c,d,e) (p)->lpVtbl->CreateDeviceFromClipper(p,a,b,c,d,e) +#define IDirect3DRM_CreateTextureFromSurface(p,a,b) (p)->lpVtbl->CreateTextureFromSurface(p,a,b) +#define IDirect3DRM_CreateShadow(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateShadow(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DRM_CreateViewport(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateViewport(p,a,b,c,d,e,f,g) +#define IDirect3DRM_CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) (p)->lpVtbl->CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) +#define IDirect3DRM_CreateUserVisual(p,a,b,c) (p)->lpVtbl->CreateUserVisual(p,a,b,c) +#define IDirect3DRM_LoadTexture(p,a,b) (p)->lpVtbl->LoadTexture(p,a,b) +#define IDirect3DRM_LoadTextureFromResource(p,a,b) (p)->lpVtbl->LoadTextureFromResource(p,a,b) +#define IDirect3DRM_SetSearchPath(p,a) (p)->lpVtbl->SetSearchPath(p,a) +#define IDirect3DRM_AddSearchPath(p,a) (p)->lpVtbl->AddSearchPath(p,a) +#define IDirect3DRM_GetSearchPath(p,a,b) (p)->lpVtbl->GetSearchPath(p,a,b) +#define IDirect3DRM_SetDefaultTextureColors(p,a) (p)->lpVtbl->SetDefaultTextureColors(p,a) +#define IDirect3DRM_SetDefaultTextureShades(p,a) (p)->lpVtbl->SetDefaultTextureShades(p,a) +#define IDirect3DRM_GetDevices(p,a) (p)->lpVtbl->GetDevices(p,a) +#define IDirect3DRM_GetNamedObject(p,a,b) (p)->lpVtbl->GetNamedObject(p,a,b) +#define IDirect3DRM_EnumerateObjects(p,a,b) (p)->lpVtbl->EnumerateObjects(p,a,b) +#define IDirect3DRM_Load(p,a,b,c,d,e,f,g,h,i,j) (p)->lpVtbl->Load(p,a,b,c,d,e,f,g,h,i,j) +#define IDirect3DRM_Tick(p,a) (p)->lpVtbl->Tick(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRM_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRM_AddRef(p) (p)->AddRef() +#define IDirect3DRM_Release(p) (p)->Release() +/*** IDirect3DRM methods ***/ +#define IDirect3DRM_CreateObject(p,a,b,c,d) (p)->CreateObject(a,b,c,d) +#define IDirect3DRM_CreateFrame(p,a,b) (p)->CreateFrame(a,b) +#define IDirect3DRM_CreateMesh(p,a) (p)->CreateMesh(a) +#define IDirect3DRM_CreateMeshBuilder(p,a) (p)->CreateMeshBuilder(a) +#define IDirect3DRM_CreateFace(p,a) (p)->CreateFace(a) +#define IDirect3DRM_CreateAnimation(p,a) (p)->CreateAnimation(a) +#define IDirect3DRM_CreateAnimationSet(p,a) (p)->CreateAnimationSet(a) +#define IDirect3DRM_CreateTexture(p,a,b) (p)->CreateTexture(a,b) +#define IDirect3DRM_CreateLight(p,a,b,c) (p)->CreateLight(a,b,c) +#define IDirect3DRM_CreateLightRGB(p,a,b,c,d,e) (p)->CreateLightRGB(a,b,c,d,e) +#define IDirect3DRM_CreateMaterial(p,a,b) (p)->CreateMaterial(a,b) +#define IDirect3DRM_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirect3DRM_CreateDeviceFromSurface(p,a,b,c,d) (p)->CreateDeviceFromSurface(a,b,c,d) +#define IDirect3DRM_CreateDeviceFromD3D(p,a,b,c) (p)->CreateDeviceFromD3D(a,b,c) +#define IDirect3DRM_CreateDeviceFromClipper(p,a,b,c,d,e) (p)->CreateDeviceFromClipper(a,b,c,d,e) +#define IDirect3DRM_CreateTextureFromSurface(p,a,b) (p)->CreateTextureFromSurface(a,b) +#define IDirect3DRM_CreateShadow(p,a,b,c,d,e,f,g,h,i) (p)->CreateShadow(a,b,c,d,e,f,g,h,i) +#define IDirect3DRM_CreateViewport(p,a,b,c,d,e,f,g) (p)->CreateViewport(a,b,c,d,e,f,g) +#define IDirect3DRM_CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) (p)->CreateWrap(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) +#define IDirect3DRM_CreateUserVisual(p,a,b,c) (p)->CreateUserVisual(a,b,c) +#define IDirect3DRM_LoadTexture(p,a,b) (p)->LoadTexture(a,b) +#define IDirect3DRM_LoadTextureFromResource(p,a,b) (p)->LoadTextureFromResource(a,b) +#define IDirect3DRM_SetSearchPath(p,a) (p)->SetSearchPath(a) +#define IDirect3DRM_AddSearchPath(p,a) (p)->AddSearchPath(a) +#define IDirect3DRM_GetSearchPath(p,a,b) (p)->GetSearchPath(a,b) +#define IDirect3DRM_SetDefaultTextureColors(p,a) (p)->SetDefaultTextureColors(a) +#define IDirect3DRM_SetDefaultTextureShades(p,a) (p)->SetDefaultTextureShades(a) +#define IDirect3DRM_GetDevices(p,a) (p)->GetDevices(a) +#define IDirect3DRM_GetNamedObject(p,a,b) (p)->GetNamedObject(a,b) +#define IDirect3DRM_EnumerateObjects(p,a,b) (p)->EnumerateObjects(a,b) +#define IDirect3DRM_Load(p,a,b,c,d,e,f,g,h,i,j) (p)->Load(a,b,c,d,e,f,g,h,i,j) +#define IDirect3DRM_Tick(p,a) (p)->Tick(a) +#endif + +/***************************************************************************** + * IDirect3DRM2 interface + */ +#ifdef WINE_NO_UNICODE_MACROS +#undef GetClassName +#endif +#define INTERFACE IDirect3DRM2 +DECLARE_INTERFACE_(IDirect3DRM2,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRM2 methods ***/ + STDMETHOD(CreateObject)(THIS_ REFCLSID clsid, IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(CreateFrame)(THIS_ IDirect3DRMFrame *parent, IDirect3DRMFrame2 **frame) PURE; + STDMETHOD(CreateMesh)(THIS_ IDirect3DRMMesh **mesh) PURE; + STDMETHOD(CreateMeshBuilder)(THIS_ IDirect3DRMMeshBuilder2 **mesh_builder) PURE; + STDMETHOD(CreateFace)(THIS_ IDirect3DRMFace **face) PURE; + STDMETHOD(CreateAnimation)(THIS_ IDirect3DRMAnimation **animation) PURE; + STDMETHOD(CreateAnimationSet)(THIS_ IDirect3DRMAnimationSet **set) PURE; + STDMETHOD(CreateTexture)(THIS_ D3DRMIMAGE *image, IDirect3DRMTexture2 **texture) PURE; + STDMETHOD(CreateLight)(THIS_ D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light) PURE; + STDMETHOD(CreateLightRGB)(THIS_ D3DRMLIGHTTYPE type, D3DVALUE r, D3DVALUE g, D3DVALUE b, + IDirect3DRMLight **light) PURE; + STDMETHOD(CreateMaterial)(THIS_ D3DVALUE power, IDirect3DRMMaterial **material) PURE; + STDMETHOD(CreateDevice)(THIS_ DWORD width, DWORD height, IDirect3DRMDevice2 **device) PURE; + STDMETHOD(CreateDeviceFromSurface)(THIS_ GUID *guid, IDirectDraw *ddraw, + IDirectDrawSurface *surface, IDirect3DRMDevice2 **device) PURE; + STDMETHOD(CreateDeviceFromD3D)(THIS_ IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device, + IDirect3DRMDevice2 **device) PURE; + STDMETHOD(CreateDeviceFromClipper)(THIS_ IDirectDrawClipper *clipper, GUID *guid, + int width, int height, IDirect3DRMDevice2 **device) PURE; + STDMETHOD(CreateTextureFromSurface)(THIS_ IDirectDrawSurface *surface, + IDirect3DRMTexture2 **texture) PURE; + STDMETHOD(CreateShadow)(THIS_ IDirect3DRMVisual *visual, IDirect3DRMLight *light, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, + IDirect3DRMVisual **shadow) PURE; + STDMETHOD(CreateViewport)(THIS_ IDirect3DRMDevice *device, IDirect3DRMFrame *camera, + DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport **viewport) PURE; + STDMETHOD(CreateWrap)(THIS_ D3DRMWRAPTYPE type, IDirect3DRMFrame *reference, D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, D3DVALUE ou, D3DVALUE ov, + D3DVALUE su, D3DVALUE sv, IDirect3DRMWrap **wrap) PURE; + STDMETHOD(CreateUserVisual)(THIS_ D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual) PURE; + STDMETHOD(LoadTexture)(THIS_ const char *filename, IDirect3DRMTexture2 **texture) PURE; + STDMETHOD(LoadTextureFromResource)(THIS_ HMODULE module, const char *resource_name, + const char *resource_type, IDirect3DRMTexture2 **texture) PURE; + STDMETHOD(SetSearchPath)(THIS_ const char *path) PURE; + STDMETHOD(AddSearchPath)(THIS_ const char *path) PURE; + STDMETHOD(GetSearchPath)(THIS_ DWORD *size, char *path) PURE; + STDMETHOD(SetDefaultTextureColors)(THIS_ DWORD) PURE; + STDMETHOD(SetDefaultTextureShades)(THIS_ DWORD) PURE; + STDMETHOD(GetDevices)(THIS_ IDirect3DRMDeviceArray **array) PURE; + STDMETHOD(GetNamedObject)(THIS_ const char *name, IDirect3DRMObject **object) PURE; + STDMETHOD(EnumerateObjects)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(Load)(THIS_ void *source, void *object_id, IID **iids, DWORD iid_count, D3DRMLOADOPTIONS flags, + D3DRMLOADCALLBACK load_cb, void *load_ctx, D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx, + IDirect3DRMFrame *parent_frame) PURE; + STDMETHOD(Tick)(THIS_ D3DVALUE) PURE; + STDMETHOD(CreateProgressiveMesh)(THIS_ IDirect3DRMProgressiveMesh **mesh) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRM2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRM2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRM2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRM2 methods ***/ +#define IDirect3DRM2_CreateObject(p,a,b,c,d) (p)->lpVtbl->CreateObject(p,a,b,c,d) +#define IDirect3DRM2_CreateFrame(p,a,b) (p)->lpVtbl->CreateFrame(p,a,b) +#define IDirect3DRM2_CreateMesh(p,a) (p)->lpVtbl->CreateMesh(p,a) +#define IDirect3DRM2_CreateMeshBuilder(p,a) (p)->lpVtbl->CreateMeshBuilder(p,a) +#define IDirect3DRM2_CreateFace(p,a) (p)->lpVtbl->CreateFace(p,a) +#define IDirect3DRM2_CreateAnimation(p,a) (p)->lpVtbl->CreateAnimation(p,a) +#define IDirect3DRM2_CreateAnimationSet(p,a) (p)->lpVtbl->CreateAnimationSet(p,a) +#define IDirect3DRM2_CreateTexture(p,a,b) (p)->lpVtbl->CreateTexture(p,a,b) +#define IDirect3DRM2_CreateLight(p,a,b,c) (p)->lpVtbl->CreateLight(p,a,b,c) +#define IDirect3DRM2_CreateLightRGB(p,a,b,c,d,e) (p)->lpVtbl->CreateLightRGB(p,a,b,c,d,e) +#define IDirect3DRM2_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b) +#define IDirect3DRM2_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirect3DRM2_CreateDeviceFromSurface(p,a,b,c,d) (p)->lpVtbl->CreateDeviceFromSurface(p,a,b,c,d) +#define IDirect3DRM2_CreateDeviceFromD3D(p,a,b,c) (p)->lpVtbl->CreateDeviceFromD3D(p,a,b,c) +#define IDirect3DRM2_CreateDeviceFromClipper(p,a,b,c,d,e) (p)->lpVtbl->CreateDeviceFromClipper(p,a,b,c,d,e) +#define IDirect3DRM2_CreateTextureFromSurface(p,a,b) (p)->lpVtbl->CreateTextureFromSurface(p,a,b) +#define IDirect3DRM2_CreateShadow(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateShadow(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DRM2_CreateViewport(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateViewport(p,a,b,c,d,e,f,g) +#define IDirect3DRM2_CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) (p)->lpVtbl->CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) +#define IDirect3DRM2_CreateUserVisual(p,a,b,c) (p)->lpVtbl->CreateUserVisual(p,a,b,c) +#define IDirect3DRM2_LoadTexture(p,a,b) (p)->lpVtbl->LoadTexture(p,a,b) +#define IDirect3DRM2_LoadTextureFromResource(p,a,b,c,d) (p)->lpVtbl->LoadTextureFromResource(p,a,b,c,d) +#define IDirect3DRM2_SetSearchPath(p,a) (p)->lpVtbl->SetSearchPath(p,a) +#define IDirect3DRM2_AddSearchPath(p,a) (p)->lpVtbl->AddSearchPath(p,a) +#define IDirect3DRM2_GetSearchPath(p,a,b) (p)->lpVtbl->GetSearchPath(p,a,b) +#define IDirect3DRM2_SetDefaultTextureColors(p,a) (p)->lpVtbl->SetDefaultTextureColors(p,a) +#define IDirect3DRM2_SetDefaultTextureShades(p,a) (p)->lpVtbl->SetDefaultTextureShades(p,a) +#define IDirect3DRM2_GetDevices(p,a) (p)->lpVtbl->GetDevices(p,a) +#define IDirect3DRM2_GetNamedObject(p,a,b) (p)->lpVtbl->GetNamedObject(p,a,b) +#define IDirect3DRM2_EnumerateObjects(p,a,b) (p)->lpVtbl->EnumerateObjects(p,a,b) +#define IDirect3DRM2_Load(p,a,b,c,d,e,f,g,h,i,j) (p)->lpVtbl->Load(p,a,b,c,d,e,f,g,h,i,j) +#define IDirect3DRM2_Tick(p,a) (p)->lpVtbl->Tick(p,a) +#define IDirect3DRM2_CreateProgressiveMesh(p,a) (p)->lpVtbl->CreateProgressiveMesh(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRM2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRM2_AddRef(p) (p)->AddRef() +#define IDirect3DRM2_Release(p) (p)->Release() +/*** IDirect3DRM2 methods ***/ +#define IDirect3DRM2_CreateObject(p,a,b,c,d) (p)->CreateObject(a,b,c,d) +#define IDirect3DRM2_CreateFrame(p,a,b) (p)->CreateFrame(a,b) +#define IDirect3DRM2_CreateMesh(p,a) (p)->CreateMesh(a) +#define IDirect3DRM2_CreateMeshBuilder(p,a) (p)->CreateMeshBuilder(a) +#define IDirect3DRM2_CreateFace(p,a) (p)->CreateFace(a) +#define IDirect3DRM2_CreateAnimation(p,a) (p)->CreateAnimation(a) +#define IDirect3DRM2_CreateAnimationSet(p,a) (p)->CreateAnimationSet(a) +#define IDirect3DRM2_CreateTexture(p,a,b) (p)->CreateTexture(a,b) +#define IDirect3DRM2_CreateLight(p,a,b,c) (p)->CreateLight(a,b,c) +#define IDirect3DRM2_CreateLightRGB(p,a,b,c,d,e) (p)->CreateLightRGB(a,b,c,d,e) +#define IDirect3DRM2_CreateMaterial(p,a,b) (p)->CreateMaterial(a,b) +#define IDirect3DRM2_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirect3DRM2_CreateDeviceFromSurface(p,a,b,c,d) (p)->CreateDeviceFromSurface(a,b,c,d) +#define IDirect3DRM2_CreateDeviceFromD3D(p,a,b,c) (p)->CreateDeviceFromD3D(a,b,c) +#define IDirect3DRM2_CreateDeviceFromClipper(p,a,b,c,d,e) (p)->CreateDeviceFromClipper(a,b,c,d,e) +#define IDirect3DRM2_CreateTextureFromSurface(p,a,b) (p)->CreateTextureFromSurface(a,b) +#define IDirect3DRM2_CreateShadow(p,a,b,c,d,e,f,g,h,i) (p)->CreateShadow(a,b,c,d,e,f,g,h,i) +#define IDirect3DRM2_CreateViewport(p,a,b,c,d,e,f,g) (p)->CreateViewport(a,b,c,d,e,f,g) +#define IDirect3DRM2_CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) (p)->CreateWrap(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) +#define IDirect3DRM2_CreateUserVisual(p,a,b,c) (p)->CreateUserVisual(a,b,c) +#define IDirect3DRM2_LoadTexture(p,a,b) (p)->LoadTexture(a,b) +#define IDirect3DRM2_LoadTextureFromResource(p,a,b,c,d) (p)->LoadTextureFromResource(a,b,c,d) +#define IDirect3DRM2_SetSearchPath(p,a) (p)->SetSearchPath(a) +#define IDirect3DRM2_AddSearchPath(p,a) (p)->AddSearchPath(a) +#define IDirect3DRM2_GetSearchPath(p,a,b) (p)->GetSearchPath(a,b) +#define IDirect3DRM2_SetDefaultTextureColors(p,a) (p)->SetDefaultTextureColors(a) +#define IDirect3DRM2_SetDefaultTextureShades(p,a) (p)->SetDefaultTextureShades(a) +#define IDirect3DRM2_GetDevices(p,a) (p)->GetDevices(a) +#define IDirect3DRM2_GetNamedObject(p,a,b) (p)->GetNamedObject(a,b) +#define IDirect3DRM2_EnumerateObjects(p,a,b) (p)->EnumerateObjects(a,b) +#define IDirect3DRM2_Load(p,a,b,c,d,e,f,g,h,i,j) (p)->Load(a,b,c,d,e,f,g,h,i,j) +#define IDirect3DRM2_Tick(p,a) (p)->Tick(a) +#define IDirect3DRM2_CreateProgressiveMesh(p,a) (p)->CreateProgressiveMesh(a) +#endif + +/***************************************************************************** + * IDirect3DRM3 interface + */ +#ifdef WINE_NO_UNICODE_MACROS +#undef GetClassName +#endif +#define INTERFACE IDirect3DRM3 +DECLARE_INTERFACE_(IDirect3DRM3,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRM2 methods ***/ + STDMETHOD(CreateObject)(THIS_ REFCLSID clsid, IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(CreateFrame)(THIS_ IDirect3DRMFrame3 *parent, IDirect3DRMFrame3 **frame) PURE; + STDMETHOD(CreateMesh)(THIS_ IDirect3DRMMesh **mesh) PURE; + STDMETHOD(CreateMeshBuilder)(THIS_ IDirect3DRMMeshBuilder3 **mesh_builder) PURE; + STDMETHOD(CreateFace)(THIS_ IDirect3DRMFace2 **face) PURE; + STDMETHOD(CreateAnimation)(THIS_ IDirect3DRMAnimation2 **animation) PURE; + STDMETHOD(CreateAnimationSet)(THIS_ IDirect3DRMAnimationSet2 **set) PURE; + STDMETHOD(CreateTexture)(THIS_ D3DRMIMAGE *image, IDirect3DRMTexture3 **texture) PURE; + STDMETHOD(CreateLight)(THIS_ D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light) PURE; + STDMETHOD(CreateLightRGB)(THIS_ D3DRMLIGHTTYPE type, D3DVALUE r, D3DVALUE g, D3DVALUE b, + IDirect3DRMLight **light) PURE; + STDMETHOD(CreateMaterial)(THIS_ D3DVALUE, IDirect3DRMMaterial2 **material) PURE; + STDMETHOD(CreateDevice)(THIS_ DWORD width, DWORD height, IDirect3DRMDevice3 **device) PURE; + STDMETHOD(CreateDeviceFromSurface)(THIS_ GUID *guid, IDirectDraw *ddraw, + IDirectDrawSurface *surface, DWORD flags, IDirect3DRMDevice3 **device) PURE; + STDMETHOD(CreateDeviceFromD3D)(THIS_ IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device, + IDirect3DRMDevice3 **device) PURE; + STDMETHOD(CreateDeviceFromClipper)(THIS_ IDirectDrawClipper *clipper, GUID *guid, + int width, int height, IDirect3DRMDevice3 **device) PURE; + STDMETHOD(CreateTextureFromSurface)(THIS_ IDirectDrawSurface *surface, + IDirect3DRMTexture3 **texture) PURE; + STDMETHOD(CreateShadow)(THIS_ IUnknown *object, IDirect3DRMLight *light, D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, IDirect3DRMShadow2 **shadow) PURE; + STDMETHOD(CreateViewport)(THIS_ IDirect3DRMDevice3 *device, IDirect3DRMFrame3 *camera, + DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport2 **viewport) PURE; + STDMETHOD(CreateWrap)(THIS_ D3DRMWRAPTYPE type, IDirect3DRMFrame3 *reference, + D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, D3DVALUE ou, D3DVALUE ov, D3DVALUE su, D3DVALUE sv, + IDirect3DRMWrap **wrap) PURE; + STDMETHOD(CreateUserVisual)(THIS_ D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual) PURE; + STDMETHOD(LoadTexture)(THIS_ const char *filename, IDirect3DRMTexture3 **texture) PURE; + STDMETHOD(LoadTextureFromResource)(THIS_ HMODULE module, const char *resource_name, + const char *resource_type, IDirect3DRMTexture3 **texture) PURE; + STDMETHOD(SetSearchPath)(THIS_ const char *path) PURE; + STDMETHOD(AddSearchPath)(THIS_ const char *path) PURE; + STDMETHOD(GetSearchPath)(THIS_ DWORD *size, char *path) PURE; + STDMETHOD(SetDefaultTextureColors)(THIS_ DWORD) PURE; + STDMETHOD(SetDefaultTextureShades)(THIS_ DWORD) PURE; + STDMETHOD(GetDevices)(THIS_ IDirect3DRMDeviceArray **array) PURE; + STDMETHOD(GetNamedObject)(THIS_ const char *name, IDirect3DRMObject **object) PURE; + STDMETHOD(EnumerateObjects)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(Load)(THIS_ void *source, void *object_id, IID **iids, DWORD iid_count, D3DRMLOADOPTIONS flags, + D3DRMLOADCALLBACK load_cb, void *load_ctx, D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx, + IDirect3DRMFrame3 *parent_frame) PURE; + STDMETHOD(Tick)(THIS_ D3DVALUE) PURE; + STDMETHOD(CreateProgressiveMesh)(THIS_ IDirect3DRMProgressiveMesh **mesh) PURE; + STDMETHOD(RegisterClient)(THIS_ REFGUID guid, DWORD *id) PURE; + STDMETHOD(UnregisterClient)(THIS_ REFGUID rguid) PURE; + STDMETHOD(CreateClippedVisual)(THIS_ IDirect3DRMVisual *visual, IDirect3DRMClippedVisual **clipped_visual) PURE; + STDMETHOD(SetOptions)(THIS_ DWORD) PURE; + STDMETHOD(GetOptions)(THIS_ DWORD *flags) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRM3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRM3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRM3_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRM3 methods ***/ +#define IDirect3DRM3_CreateObject(p,a,b,c,d) (p)->lpVtbl->CreateObject(p,a,b,c,d) +#define IDirect3DRM3_CreateFrame(p,a,b) (p)->lpVtbl->CreateFrame(p,a,b) +#define IDirect3DRM3_CreateMesh(p,a) (p)->lpVtbl->CreateMesh(p,a) +#define IDirect3DRM3_CreateMeshBuilder(p,a) (p)->lpVtbl->CreateMeshBuilder(p,a) +#define IDirect3DRM3_CreateFace(p,a) (p)->lpVtbl->CreateFace(p,a) +#define IDirect3DRM3_CreateAnimation(p,a) (p)->lpVtbl->CreateAnimation(p,a) +#define IDirect3DRM3_CreateAnimationSet(p,a) (p)->lpVtbl->CreateAnimationSet(p,a) +#define IDirect3DRM3_CreateTexture(p,a,b) (p)->lpVtbl->CreateTexture(p,a,b) +#define IDirect3DRM3_CreateLight(p,a,b,c) (p)->lpVtbl->CreateLight(p,a,b,c) +#define IDirect3DRM3_CreateLightRGB(p,a,b,c,d,e) (p)->lpVtbl->CreateLightRGB(p,a,b,c,d,e) +#define IDirect3DRM3_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b) +#define IDirect3DRM3_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirect3DRM3_CreateDeviceFromSurface(p,a,b,c,d,e) (p)->lpVtbl->CreateDeviceFromSurface(p,a,b,c,d,e) +#define IDirect3DRM3_CreateDeviceFromD3D(p,a,b,c) (p)->lpVtbl->CreateDeviceFromD3D(p,a,b,c) +#define IDirect3DRM3_CreateDeviceFromClipper(p,a,b,c,d,e) (p)->lpVtbl->CreateDeviceFromClipper(p,a,b,c,d,e) +#define IDirect3DRM3_CreateTextureFromSurface(p,a,b) (p)->lpVtbl->CreateTextureFromSurface(p,a,b) +#define IDirect3DRM3_CreateShadow(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateShadow(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DRM3_CreateViewport(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateViewport(p,a,b,c,d,e,f,g) +#define IDirect3DRM3_CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) (p)->lpVtbl->CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) +#define IDirect3DRM3_CreateUserVisual(p,a,b,c) (p)->lpVtbl->CreateUserVisual(p,a,b,c) +#define IDirect3DRM3_LoadTexture(p,a,b) (p)->lpVtbl->LoadTexture(p,a,b) +#define IDirect3DRM3_LoadTextureFromResource(p,a,b,c,d) (p)->lpVtbl->LoadTextureFromResource(p,a,b,c,d) +#define IDirect3DRM3_SetSearchPath(p,a) (p)->lpVtbl->SetSearchPath(p,a) +#define IDirect3DRM3_AddSearchPath(p,a) (p)->lpVtbl->AddSearchPath(p,a) +#define IDirect3DRM3_GetSearchPath(p,a,b) (p)->lpVtbl->GetSearchPath(p,a,b) +#define IDirect3DRM3_SetDefaultTextureColors(p,a) (p)->lpVtbl->SetDefaultTextureColors(p,a) +#define IDirect3DRM3_SetDefaultTextureShades(p,a) (p)->lpVtbl->SetDefaultTextureShades(p,a) +#define IDirect3DRM3_GetDevices(p,a) (p)->lpVtbl->GetDevices(p,a) +#define IDirect3DRM3_GetNamedObject(p,a,b) (p)->lpVtbl->GetNamedObject(p,a,b) +#define IDirect3DRM3_EnumerateObjects(p,a,b) (p)->lpVtbl->EnumerateObjects(p,a,b) +#define IDirect3DRM3_Load(p,a,b,c,d,e,f,g,h,i,j) (p)->lpVtbl->Load(p,a,b,c,d,e,f,g,h,i,j) +#define IDirect3DRM3_Tick(p,a) (p)->lpVtbl->Tick(p,a) +#define IDirect3DRM3_CreateProgressiveMesh(p,a) (p)->lpVtbl->CreateProgressiveMesh(p,a) +#define IDirect3DRM3_RegisterClient(p,a,b) (p)->lpVtbl->RegisterClient(p,a,b) +#define IDirect3DRM3_UnregisterClient(p,a) (p)->lpVtbl->UnregisterClient(p,a) +#define IDirect3DRM3_CreateClippedVisual(p,a,b) (p)->lpVtbl->CreateClippedVisual(p,a,b) +#define IDirect3DRM3_SetOptions(p,a) (p)->lpVtbl->SetOptions(p,a) +#define IDirect3DRM3_GetOptions(p,a) (p)->lpVtbl->GetOptions(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRM3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRM3_AddRef(p) (p)->AddRef() +#define IDirect3DRM3_Release(p) (p)->Release() +/*** IDirect3DRM3 methods ***/ +#define IDirect3DRM3_CreateObject(p,a,b,c,d) (p)->CreateObject(a,b,c,d) +#define IDirect3DRM3_CreateFrame(p,a,b) (p)->CreateFrame(a,b) +#define IDirect3DRM3_CreateMesh(p,a) (p)->CreateMesh(a) +#define IDirect3DRM3_CreateMeshBuilder(p,a) (p)->CreateMeshBuilder(a) +#define IDirect3DRM3_CreateFace(p,a) (p)->CreateFace(a) +#define IDirect3DRM3_CreateAnimation(p,a) (p)->CreateAnimation(a) +#define IDirect3DRM3_CreateAnimationSet(p,a) (p)->CreateAnimationSet(a) +#define IDirect3DRM3_CreateTexture(p,a,b) (p)->CreateTexture(a,b) +#define IDirect3DRM3_CreateLight(p,a,b,c) (p)->CreateLight(a,b,c) +#define IDirect3DRM3_CreateLightRGB(p,a,b,c,d,e) (p)->CreateLightRGB(a,b,c,d,e) +#define IDirect3DRM3_CreateMaterial(p,a,b) (p)->CreateMaterial(a,b) +#define IDirect3DRM3_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirect3DRM3_CreateDeviceFromSurface(p,a,b,c,d,e) (p)->CreateDeviceFromSurface(a,b,c,d,e) +#define IDirect3DRM3_CreateDeviceFromD3D(p,a,b,c) (p)->CreateDeviceFromD3D(a,b,c) +#define IDirect3DRM3_CreateDeviceFromClipper(p,a,b,c,d,e) (p)->CreateDeviceFromClipper(a,b,c,d,e) +#define IDirect3DRM3_CreateTextureFromSurface(p,a,b) (p)->CreateTextureFromSurface(a,b) +#define IDirect3DRM3_CreateShadow(p,a,b,c,d,e,f,g,h,i) (p)->CreateShadow(a,b,c,d,e,f,g,h,i) +#define IDirect3DRM3_CreateViewport(p,a,b,c,d,e,f,g) (p)->CreateViewport(a,b,c,d,e,f,g) +#define IDirect3DRM3_CreateWrap(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) (p)->CreateWrap(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q) +#define IDirect3DRM3_CreateUserVisual(p,a,b,c) (p)->CreateUserVisual(a,b,c) +#define IDirect3DRM3_LoadTexture(p,a,b) (p)->LoadTexture(a,b) +#define IDirect3DRM3_LoadTextureFromResource(p,a,b,c,d) (p)->LoadTextureFromResource(a,b,c,d) +#define IDirect3DRM3_SetSearchPath(p,a) (p)->SetSearchPath(a) +#define IDirect3DRM3_AddSearchPath(p,a) (p)->AddSearchPath(a) +#define IDirect3DRM3_GetSearchPath(p,a,b) (p)->GetSearchPath(a,b) +#define IDirect3DRM3_SetDefaultTextureColors(p,a) (p)->SetDefaultTextureColors(a) +#define IDirect3DRM3_SetDefaultTextureShades(p,a) (p)->SetDefaultTextureShades(a) +#define IDirect3DRM3_GetDevices(p,a) (p)->GetDevices(a) +#define IDirect3DRM3_GetNamedObject(p,a,b) (p)->GetNamedObject(a,b) +#define IDirect3DRM3_EnumerateObjects(p,a,b) (p)->EnumerateObjects(a,b) +#define IDirect3DRM3_Load(p,a,b,c,d,e,f,g,h,i,j) (p)->Load(a,b,c,d,e,f,g,h,i,j) +#define IDirect3DRM3_Tick(p,a) (p)->Tick(a) +#define IDirect3DRM3_CreateProgressiveMesh(p,a) (p)->CreateProgressiveMesh(a) +#define IDirect3DRM3_RegisterClient(p,a,b) (p)->RegisterClient(a,b) +#define IDirect3DRM3_UnregisterClient(p,a) (p)->UnregisterClient(a) +#define IDirect3DRM3_CreateClippedVisual(p,a,b) (p)->CreateClippedVisual(a,b) +#define IDirect3DRM3_SetOptions(p,a) (p)->SetOptions(a) +#define IDirect3DRM3_GetOptions(p,a) (p)->GetOptions(a) +#endif + +#define D3DRM_OK DD_OK +#define D3DRMERR_BADOBJECT MAKE_DDHRESULT(781) +#define D3DRMERR_BADTYPE MAKE_DDHRESULT(782) +#define D3DRMERR_BADALLOC MAKE_DDHRESULT(783) +#define D3DRMERR_FACEUSED MAKE_DDHRESULT(784) +#define D3DRMERR_NOTFOUND MAKE_DDHRESULT(785) +#define D3DRMERR_NOTDONEYET MAKE_DDHRESULT(786) +#define D3DRMERR_FILENOTFOUND MAKE_DDHRESULT(787) +#define D3DRMERR_BADFILE MAKE_DDHRESULT(788) +#define D3DRMERR_BADDEVICE MAKE_DDHRESULT(789) +#define D3DRMERR_BADVALUE MAKE_DDHRESULT(790) +#define D3DRMERR_BADMAJORVERSION MAKE_DDHRESULT(791) +#define D3DRMERR_BADMINORVERSION MAKE_DDHRESULT(792) +#define D3DRMERR_UNABLETOEXECUTE MAKE_DDHRESULT(793) +#define D3DRMERR_LIBRARYNOTFOUND MAKE_DDHRESULT(794) +#define D3DRMERR_INVALIDLIBRARY MAKE_DDHRESULT(795) +#define D3DRMERR_PENDING MAKE_DDHRESULT(796) +#define D3DRMERR_NOTENOUGHDATA MAKE_DDHRESULT(797) +#define D3DRMERR_REQUESTTOOLARGE MAKE_DDHRESULT(798) +#define D3DRMERR_REQUESTTOOSMALL MAKE_DDHRESULT(799) +#define D3DRMERR_CONNECTIONLOST MAKE_DDHRESULT(800) +#define D3DRMERR_LOADABORTED MAKE_DDHRESULT(801) +#define D3DRMERR_NOINTERNET MAKE_DDHRESULT(802) +#define D3DRMERR_BADCACHEFILE MAKE_DDHRESULT(803) +#define D3DRMERR_BOXNOTSET MAKE_DDHRESULT(804) +#define D3DRMERR_BADPMDATA MAKE_DDHRESULT(805) +#define D3DRMERR_CLIENTNOTREGISTERED MAKE_DDHRESULT(806) +#define D3DRMERR_NOTCREATEDFROMDDS MAKE_DDHRESULT(807) +#define D3DRMERR_NOSUCHKEY MAKE_DDHRESULT(808) +#define D3DRMERR_INCOMPATABLEKEY MAKE_DDHRESULT(809) +#define D3DRMERR_ELEMENTINUSE MAKE_DDHRESULT(810) +#define D3DRMERR_TEXTUREFORMATNOTFOUND MAKE_DDHRESULT(811) +#define D3DRMERR_NOTAGGREGATED MAKE_DDHRESULT(812) + +#ifdef __cplusplus +} +#endif + +#endif /* __D3DRM_H__ */ diff --git a/3rdparty/d3drm/include/d3drmdef.h b/3rdparty/d3drm/include/d3drmdef.h new file mode 100644 index 00000000..aa77c2c5 --- /dev/null +++ b/3rdparty/d3drm/include/d3drmdef.h @@ -0,0 +1,466 @@ +/* + * Copyright 2007,2010 Vijay Kiran Kamuju + * Copyright 2007 David ADAM + * 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 __D3DRMDEFS_H__ +#define __D3DRMDEFS_H__ + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef struct _D3DRMVECTOR4D +{ + D3DVALUE x; + D3DVALUE y; + D3DVALUE z; + D3DVALUE w; +} D3DRMVECTOR4D, *LPD3DRMVECTOR4D; + +typedef D3DVALUE D3DRMMATRIX4D[4][4]; + +typedef struct _D3DRMQUATERNION { + D3DVALUE s; + D3DVECTOR v; +} D3DRMQUATERNION, *LPD3DRMQUATERNION; + +typedef struct _D3DRMRAY { + D3DVECTOR dvDir; + D3DVECTOR dvPos; +} D3DRMRAY, *LPD3DRMRAY; + +typedef struct _D3DRMBOX { + D3DVECTOR min; + D3DVECTOR max; +} D3DRMBOX, *LPD3DRMBOX; + +typedef void (*D3DRMWRAPCALLBACK)(D3DVECTOR *vec, int *u, int *v, D3DVECTOR *a, D3DVECTOR *b, void *ctx); + +typedef enum _D3DRMLIGHTTYPE { + D3DRMLIGHT_AMBIENT, + D3DRMLIGHT_POINT, + D3DRMLIGHT_SPOT, + D3DRMLIGHT_DIRECTIONAL, + D3DRMLIGHT_PARALLELPOINT +} D3DRMLIGHTTYPE, *LPD3DRMLIGHTTYPE; + +typedef enum _D3DRMSHADEMODE { + D3DRMSHADE_FLAT = 0, + D3DRMSHADE_GOURAUD = 1, + D3DRMSHADE_PHONG = 2, + D3DRMSHADE_MASK = 7, + D3DRMSHADE_MAX = 8 +} D3DRMSHADEMODE, *LPD3DRMSHADEMODE; + +typedef enum _D3DRMLIGHTMODE { + D3DRMLIGHT_OFF = 0 * D3DRMSHADE_MAX, + D3DRMLIGHT_ON = 1 * D3DRMSHADE_MAX, + D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX, + D3DRMLIGHT_MAX = 8 * D3DRMSHADE_MAX +} D3DRMLIGHTMODE, *LPD3DRMLIGHTMODE; + +typedef enum _D3DRMFILLMODE { + D3DRMFILL_POINTS = 0 * D3DRMLIGHT_MAX, + D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX, + D3DRMFILL_SOLID = 2 * D3DRMLIGHT_MAX, + D3DRMFILL_MASK = 7 * D3DRMLIGHT_MAX, + D3DRMFILL_MAX = 8 * D3DRMLIGHT_MAX +} D3DRMFILLMODE, *LPD3DRMFILLMODE; + +typedef DWORD D3DRMRENDERQUALITY, *LPD3DRMRENDERQUALITY; + +#define D3DRMRENDER_WIREFRAME (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_WIREFRAME) +#define D3DRMRENDER_UNLITFLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_SOLID) +#define D3DRMRENDER_FLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_ON+D3DRMFILL_SOLID) +#define D3DRMRENDER_GOURAUD (D3DRMSHADE_GOURAUD+D3DRMLIGHT_ON+D3DRMFILL_SOLID) +#define D3DRMRENDER_PHONG (D3DRMSHADE_PHONG+D3DRMLIGHT_ON+D3DRMFILL_SOLID) + +#define D3DRMRENDERMODE_BLENDEDTRANSPARENCY 1 +#define D3DRMRENDERMODE_SORTEDTRANSPARENCY 2 +#define D3DRMRENDERMODE_LIGHTINMODELSPACE 8 +#define D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR 16 +#define D3DRMRENDERMODE_DISABLESORTEDALPHAZWRITE 32 + +typedef enum _D3DRMTEXTUREQUALITY { + D3DRMTEXTURE_NEAREST, + D3DRMTEXTURE_LINEAR, + D3DRMTEXTURE_MIPNEAREST, + D3DRMTEXTURE_MIPLINEAR, + D3DRMTEXTURE_LINEARMIPNEAREST, + D3DRMTEXTURE_LINEARMIPLINEAR +} D3DRMTEXTUREQUALITY, *LPD3DRMTEXTUREQUALITY; + +#define D3DRMTEXTURE_FORCERESIDENT 0x00000001 +#define D3DRMTEXTURE_STATIC 0x00000002 +#define D3DRMTEXTURE_DOWNSAMPLEPOINT 0x00000004 +#define D3DRMTEXTURE_DOWNSAMPLEBILINEAR 0x00000008 +#define D3DRMTEXTURE_DOWNSAMPLEREDUCEDEPTH 0x00000010 +#define D3DRMTEXTURE_DOWNSAMPLENONE 0x00000020 +#define D3DRMTEXTURE_CHANGEDPIXELS 0x00000040 +#define D3DRMTEXTURE_CHANGEDPALETTE 0x00000080 +#define D3DRMTEXTURE_INVALIDATEONLY 0x00000100 + +#define D3DRMSHADOW_TRUEALPHA 0x00000001 + +typedef enum _D3DRMCOMBINETYPE { + D3DRMCOMBINE_REPLACE, + D3DRMCOMBINE_BEFORE, + D3DRMCOMBINE_AFTER +} D3DRMCOMBINETYPE, *LPD3DRMCOMBINETYPE; + +typedef D3DCOLORMODEL D3DRMCOLORMODEL, *LPD3DRMCOLORMODEL; + +typedef enum _D3DRMPALETTEFLAGS +{ + D3DRMPALETTE_FREE, + D3DRMPALETTE_READONLY, + D3DRMPALETTE_RESERVED +} D3DRMPALETTEFLAGS, *LPD3DRMPALETTEFLAGS; + +typedef struct _D3DRMPALETTEENTRY { + unsigned char red; + unsigned char green; + unsigned char blue; + unsigned char flags; +} D3DRMPALETTEENTRY, *LPD3DRMPALETTEENTRY; + +typedef struct _D3DRMIMAGE { + int width; + int height; + int aspectx; + int aspecty; + int depth; + int rgb; + int bytes_per_line; + void* buffer1; + void* buffer2; + ULONG red_mask; + ULONG green_mask; + ULONG blue_mask; + ULONG alpha_mask; + int palette_size; + D3DRMPALETTEENTRY* palette; +} D3DRMIMAGE, *LPD3DRMIMAGE; + +typedef enum _D3DRMWRAPTYPE { + D3DRMWRAP_FLAT, + D3DRMWRAP_CYLINDER, + D3DRMWRAP_SPHERE, + D3DRMWRAP_CHROME, + D3DRMWRAP_SHEET, + D3DRMWRAP_BOX +} D3DRMWRAPTYPE, *LPD3DRMWRAPTYPE; + +#define D3DRMWIREFRAME_CULL 1 +#define D3DRMWIREFRAME_HIDDENLINE 2 + +typedef enum _D3DRMPROJECTIONTYPE +{ + D3DRMPROJECT_PERSPECTIVE, + D3DRMPROJECT_ORTHOGRAPHIC, + D3DRMPROJECT_RIGHTHANDPERSPECTIVE, + D3DRMPROJECT_RIGHTHANDORTHOGRAPHIC +} D3DRMPROJECTIONTYPE, *LPD3DRMPROJECTIONTYPE; + +#define D3DRMOPTIONS_LEFTHANDED 0x00000001 +#define D3DRMOPTIONS_RIGHTHANDED 0x00000002 + +typedef enum _D3DRMXOFFORMAT { + D3DRMXOF_BINARY, + D3DRMXOF_COMPRESSED, + D3DRMXOF_TEXT +} D3DRMXOFFORMAT, *LPD3DRMXOFFORMAT; + +typedef DWORD D3DRMSAVEOPTIONS; +#define D3DRMXOFSAVE_NORMALS 1 +#define D3DRMXOFSAVE_TEXTURECOORDINATES 2 +#define D3DRMXOFSAVE_MATERIALS 4 +#define D3DRMXOFSAVE_TEXTURENAMES 8 +#define D3DRMXOFSAVE_ALL 15 +#define D3DRMXOFSAVE_TEMPLATES 16 +#define D3DRMXOFSAVE_TEXTURETOPOLOGY 32 + +typedef enum _D3DRMCOLORSOURCE { + D3DRMCOLOR_FROMFACE, + D3DRMCOLOR_FROMVERTEX +} D3DRMCOLORSOURCE, *LPD3DRMCOLORSOURCE; + +typedef enum _D3DRMFRAMECONSTRAINT { + D3DRMCONSTRAIN_Z, + D3DRMCONSTRAIN_Y, + D3DRMCONSTRAIN_X +} D3DRMFRAMECONSTRAINT, *LPD3DRMFRAMECONSTRAINT; + +typedef enum _D3DRMMATERIALMODE { + D3DRMMATERIAL_FROMMESH, + D3DRMMATERIAL_FROMPARENT, + D3DRMMATERIAL_FROMFRAME +} D3DRMMATERIALMODE, *LPD3DRMMATERIALMODE; + +typedef enum _D3DRMFOGMODE { + D3DRMFOG_LINEAR, + D3DRMFOG_EXPONENTIAL, + D3DRMFOG_EXPONENTIALSQUARED +} D3DRMFOGMODE, *LPD3DRMFOGMODE; + +typedef enum _D3DRMZBUFFERMODE { + D3DRMZBUFFER_FROMPARENT, + D3DRMZBUFFER_ENABLE, + D3DRMZBUFFER_DISABLE +} D3DRMZBUFFERMODE, *LPD3DRMZBUFFERMODE; + +typedef enum _D3DRMSORTMODE { + D3DRMSORT_FROMPARENT, + D3DRMSORT_NONE, + D3DRMSORT_FRONTTOBACK, + D3DRMSORT_BACKTOFRONT +} D3DRMSORTMODE, *LPD3DRMSORTMODE; + +typedef struct _D3DRMMATERIALOVERRIDE { + DWORD dwSize; + DWORD dwFlags; + D3DCOLORVALUE dcDiffuse; + D3DCOLORVALUE dcAmbient; + D3DCOLORVALUE dcEmissive; + D3DCOLORVALUE dcSpecular; + D3DVALUE dvPower; + IUnknown *lpD3DRMTex; +} D3DRMMATERIALOVERRIDE, *LPD3DRMMATERIALOVERRIDE; + +#define D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAONLY 0x00000001 +#define D3DRMMATERIALOVERRIDE_DIFFUSE_RGBONLY 0x00000002 +#define D3DRMMATERIALOVERRIDE_DIFFUSE 0x00000003 +#define D3DRMMATERIALOVERRIDE_AMBIENT 0x00000004 +#define D3DRMMATERIALOVERRIDE_EMISSIVE 0x00000008 +#define D3DRMMATERIALOVERRIDE_SPECULAR 0x00000010 +#define D3DRMMATERIALOVERRIDE_POWER 0x00000020 +#define D3DRMMATERIALOVERRIDE_TEXTURE 0x00000040 +#define D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAMULTIPLY 0x00000080 +#define D3DRMMATERIALOVERRIDE_ALL 0x000000FF + +#define D3DRMFPTF_ALPHA 0x00000001 +#define D3DRMFPTF_NOALPHA 0x00000002 +#define D3DRMFPTF_PALETTIZED 0x00000004 +#define D3DRMFPTF_NOTPALETTIZED 0x00000008 + +#define D3DRMSTATECHANGE_UPDATEONLY 0x000000001 +#define D3DRMSTATECHANGE_VOLATILE 0x000000002 +#define D3DRMSTATECHANGE_NONVOLATILE 0x000000004 +#define D3DRMSTATECHANGE_RENDER 0x000000020 +#define D3DRMSTATECHANGE_LIGHT 0x000000040 + +#define D3DRMDEVICE_NOZBUFFER 0x00000001 + +#define D3DRMCALLBACK_PREORDER 0 +#define D3DRMCALLBACK_POSTORDER 1 + +#define D3DRMRAYPICK_ONLYBOUNDINGBOXES 0x01 +#define D3DRMRAYPICK_IGNOREFURTHERPRIMITIVES 0x02 +#define D3DRMRAYPICK_INTERPOLATEUV 0x04 +#define D3DRMRAYPICK_INTERPOLATECOLOR 0x08 +#define D3DRMRAYPICK_INTERPOLATENORMAL 0x10 + +#define D3DRMADDFACES_VERTICESONLY 1 + +#define D3DRMGENERATENORMALS_PRECOMPACT 1 +#define D3DRMGENERATENORMALS_USECREASEANGLE 2 + +#define D3DRMMESHBUILDER_DIRECTPARENT 1 +#define D3DRMMESHBUILDER_ROOTMESH 2 + +#define D3DRMMESHBUILDER_RENDERENABLE 0x00000001 +#define D3DRMMESHBUILDER_PICKENABLE 0x00000002 + +#define D3DRMADDMESHBUILDER_DONTCOPYAPPDATA 1 +#define D3DRMADDMESHBUILDER_FLATTENSUBMESHES 2 +#define D3DRMADDMESHBUILDER_NOSUBMESHES 4 + +#define D3DRMMESHBUILDERAGE_GEOMETRY 0x00000001 +#define D3DRMMESHBUILDERAGE_MATERIALS 0x00000002 +#define D3DRMMESHBUILDERAGE_TEXTURES 0x00000004 + +#define D3DRMFVF_TYPE 0x00000001 +#define D3DRMFVF_NORMAL 0x00000002 +#define D3DRMFVF_COLOR 0x00000004 +#define D3DRMFVF_TEXTURECOORDS 0x00000008 + +#define D3DRMVERTEX_STRIP 0x00000001 +#define D3DRMVERTEX_FAN 0x00000002 +#define D3DRMVERTEX_LIST 0x00000004 + +#define D3DRMCLEAR_TARGET 0x00000001 +#define D3DRMCLEAR_ZBUFFER 0x00000002 +#define D3DRMCLEAR_DIRTYRECTS 0x00000004 +#define D3DRMCLEAR_ALL (D3DRMCLEAR_TARGET | D3DRMCLEAR_ZBUFFER | D3DRMCLEAR_DIRTYRECTS) + +#define D3DRMFOGMETHOD_VERTEX 0x00000001 +#define D3DRMFOGMETHOD_TABLE 0x00000002 +#define D3DRMFOGMETHOD_ANY 0x00000004 + +#define D3DRMFRAME_RENDERENABLE 0x00000001 +#define D3DRMFRAME_PICKENABLE 0x00000002 + +typedef DWORD D3DRMANIMATIONOPTIONS; +#define D3DRMANIMATION_OPEN 0x00000001 +#define D3DRMANIMATION_CLOSED 0x00000002 +#define D3DRMANIMATION_LINEARPOSITION 0x00000004 +#define D3DRMANIMATION_SPLINEPOSITION 0x00000008 +#define D3DRMANIMATION_SCALEANDROTATION 0x00000010 +#define D3DRMANIMATION_POSITION 0x00000020 + +typedef DWORD D3DRMINTERPOLATIONOPTIONS; +#define D3DRMINTERPOLATION_OPEN 0x0001 +#define D3DRMINTERPOLATION_CLOSED 0x0002 +#define D3DRMINTERPOLATION_NEAREST 0x0100 +#define D3DRMINTERPOLATION_LINEAR 0x0004 +#define D3DRMINTERPOLATION_SPLINE 0x0008 +#define D3DRMINTERPOLATION_VERTEXCOLOR 0x0040 +#define D3DRMINTERPOLATION_SLERPNORMALS 0x0080 + +typedef DWORD D3DRMLOADOPTIONS; + +#define D3DRMLOAD_FROMFILE __MSABI_LONG(0x000) +#define D3DRMLOAD_FROMRESOURCE __MSABI_LONG(0x001) +#define D3DRMLOAD_FROMMEMORY __MSABI_LONG(0x002) +#define D3DRMLOAD_FROMSTREAM __MSABI_LONG(0x004) +#define D3DRMLOAD_FROMURL __MSABI_LONG(0x008) + +#define D3DRMLOAD_BYNAME __MSABI_LONG(0x010) +#define D3DRMLOAD_BYPOSITION __MSABI_LONG(0x020) +#define D3DRMLOAD_BYGUID __MSABI_LONG(0x040) +#define D3DRMLOAD_FIRST __MSABI_LONG(0x080) + +#define D3DRMLOAD_INSTANCEBYREFERENCE __MSABI_LONG(0x100) +#define D3DRMLOAD_INSTANCEBYCOPYING __MSABI_LONG(0x200) + +#define D3DRMLOAD_ASYNCHRONOUS __MSABI_LONG(0x400) + +typedef struct _D3DRMLOADRESOURCE +{ + HMODULE hModule; + const char *lpName; + const char *lpType; +} D3DRMLOADRESOURCE, *LPD3DRMLOADRESOURCE; + +typedef struct _D3DRMLOADMEMORY +{ + void *lpMemory; + DWORD dSize; +} D3DRMLOADMEMORY, *LPD3DRMLOADMEMORY; + +#define D3DRMPMESHSTATUS_VALID 0x01 +#define D3DRMPMESHSTATUS_INTERRUPTED 0x02 +#define D3DRMPMESHSTATUS_BASEMESHCOMPLETE 0x04 +#define D3DRMPMESHSTATUS_COMPLETE 0x08 +#define D3DRMPMESHSTATUS_RENDERABLE 0x10 + +#define D3DRMPMESHEVENT_BASEMESH 0x01 +#define D3DRMPMESHEVENT_COMPLETE 0x02 + +typedef struct _D3DRMPMESHLOADSTATUS { + DWORD dwSize; + DWORD dwPMeshSize; + DWORD dwBaseMeshSize; + DWORD dwBytesLoaded; + DWORD dwVerticesLoaded; + DWORD dwFacesLoaded; + HRESULT dwLoadResult; + DWORD dwFlags; +} D3DRMPMESHLOADSTATUS, *LPD3DRMPMESHLOADSTATUS; + +typedef enum _D3DRMUSERVISUALREASON { + D3DRMUSERVISUAL_CANSEE, + D3DRMUSERVISUAL_RENDER +} D3DRMUSERVISUALREASON, *LPD3DRMUSERVISUALREASON; + +typedef struct _D3DRMANIMATIONKEY +{ + DWORD dwSize; + DWORD dwKeyType; + D3DVALUE dvTime; + DWORD dwID; +#if !defined(__cplusplus) || !defined(D3D_OVERLOADS) + union + { + D3DRMQUATERNION dqRotateKey; + D3DVECTOR dvScaleKey; + D3DVECTOR dvPositionKey; + } DUMMYUNIONNAME; +#else + D3DVALUE dvK[4]; +#endif +} D3DRMANIMATIONKEY; +typedef D3DRMANIMATIONKEY *LPD3DRMANIMATIONKEY; + +#define D3DRMANIMATION_ROTATEKEY 0x01 +#define D3DRMANIMATION_SCALEKEY 0x02 +#define D3DRMANIMATION_POSITIONKEY 0x03 + +typedef DWORD D3DRMMAPPING, D3DRMMAPPINGFLAG, *LPD3DRMMAPPING; +static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPU = 1; +static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPV = 2; +static const D3DRMMAPPINGFLAG D3DRMMAP_PERSPCORRECT = 4; + +typedef struct _D3DRMVERTEX { + D3DVECTOR position; + D3DVECTOR normal; + D3DVALUE tu; + D3DVALUE tv; + D3DCOLOR color; +} D3DRMVERTEX, *LPD3DRMVERTEX; + +typedef LONG D3DRMGROUPINDEX; +static const D3DRMGROUPINDEX D3DRMGROUP_ALLGROUPS = -1; + +void WINAPI D3DRMMatrixFromQuaternion(D3DRMMATRIX4D m, D3DRMQUATERNION *q); + +D3DRMQUATERNION * WINAPI D3DRMQuaternionFromRotation(D3DRMQUATERNION *x, D3DVECTOR *axis, D3DVALUE theta); +D3DRMQUATERNION * WINAPI D3DRMQuaternionMultiply(D3DRMQUATERNION *ret, D3DRMQUATERNION *x, D3DRMQUATERNION *y); +D3DRMQUATERNION * WINAPI D3DRMQuaternionSlerp(D3DRMQUATERNION *ret, + D3DRMQUATERNION *x, D3DRMQUATERNION *y, D3DVALUE alpha); + +D3DVECTOR * WINAPI D3DRMVectorAdd(D3DVECTOR *ret, D3DVECTOR *x, D3DVECTOR *y); +D3DVECTOR * WINAPI D3DRMVectorCrossProduct(D3DVECTOR *ret, D3DVECTOR *x, D3DVECTOR *y); +D3DVALUE WINAPI D3DRMVectorDotProduct(D3DVECTOR *x, D3DVECTOR *y); +D3DVECTOR * WINAPI D3DRMVectorNormalize(D3DVECTOR *x); + +#define D3DRMVectorNormalise D3DRMVectorNormalize + +D3DVALUE WINAPI D3DRMVectorModulus(D3DVECTOR *x); +D3DVECTOR * WINAPI D3DRMVectorRandom(D3DVECTOR *ret); +D3DVECTOR * WINAPI D3DRMVectorRotate(D3DVECTOR *ret, D3DVECTOR *x, D3DVECTOR *axis, D3DVALUE theta); +D3DVECTOR * WINAPI D3DRMVectorReflect(D3DVECTOR *ret, D3DVECTOR *ray, D3DVECTOR *normal); +D3DVECTOR * WINAPI D3DRMVectorScale(D3DVECTOR *ret, D3DVECTOR *x, D3DVALUE scale); +D3DVECTOR * WINAPI D3DRMVectorSubtract(D3DVECTOR *ret, D3DVECTOR *x, D3DVECTOR *y); + +D3DCOLOR WINAPI D3DRMCreateColorRGB(D3DVALUE, D3DVALUE, D3DVALUE); +D3DCOLOR WINAPI D3DRMCreateColorRGBA(D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE); +D3DVALUE WINAPI D3DRMColorGetAlpha(D3DCOLOR); +D3DVALUE WINAPI D3DRMColorGetBlue(D3DCOLOR); +D3DVALUE WINAPI D3DRMColorGetGreen(D3DCOLOR); +D3DVALUE WINAPI D3DRMColorGetRed(D3DCOLOR); + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/3rdparty/d3drm/include/d3drmobj.h b/3rdparty/d3drm/include/d3drmobj.h new file mode 100644 index 00000000..7e48d989 --- /dev/null +++ b/3rdparty/d3drm/include/d3drmobj.h @@ -0,0 +1,4702 @@ +/* + * Copyright (C) 2008 Vijay Kiran Kamuju + * Copyright (C) 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 __D3DRMOBJ_H__ +#define __D3DRMOBJ_H__ + +#include +#define VIRTUAL +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Direct3DRM object CLSIDs */ + +DEFINE_GUID(CLSID_CDirect3DRMDevice, 0x4fa3568e, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMViewport, 0x4fa3568f, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMFrame, 0x4fa35690, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMMesh, 0x4fa35691, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMMeshBuilder, 0x4fa35692, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMFace, 0x4fa35693, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMLight, 0x4fa35694, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMTexture, 0x4fa35695, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMWrap, 0x4fa35696, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMMaterial, 0x4fa35697, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMAnimation, 0x4fa35698, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMAnimationSet, 0x4fa35699, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMUserVisual, 0x4fa3569a, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMShadow, 0x4fa3569b, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMViewportInterpolator, 0xde9eaa1, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMFrameInterpolator, 0xde9eaa2, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMMeshInterpolator, 0xde9eaa3, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMLightInterpolator, 0xde9eaa6, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMMaterialInterpolator, 0xde9eaa7, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMTextureInterpolator, 0xde9eaa8, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMProgressiveMesh, 0x4516ec40, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMClippedVisual, 0x5434e72d, 0x6d66, 0x11d1, 0xbb, 0xb, 0x0, 0x0, 0xf8, 0x75, 0x86, 0x5a); + +/* Direct3DRM object interface GUIDs */ + +DEFINE_GUID(IID_IDirect3DRMObject, 0xeb16cb00, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMObject2, 0x4516ec7c, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMDevice, 0xe9e19280, 0x6e05, 0x11cf, 0xac, 0x4a, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMDevice2, 0x4516ec78, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMDevice3, 0x549f498b, 0xbfeb, 0x11d1, 0x8e, 0xd8, 0x00, 0xa0, 0xc9, 0x67, 0xa4, 0x82); +DEFINE_GUID(IID_IDirect3DRMViewport, 0xeb16cb02, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMViewport2, 0x4a1b1be6, 0xbfed, 0x11d1, 0x8e, 0xd8, 0x00, 0xa0, 0xc9, 0x67, 0xa4, 0x82); +DEFINE_GUID(IID_IDirect3DRMFrame, 0xeb16cb03, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFrame2, 0xc3dfbd60, 0x3988, 0x11d0, 0x9e, 0xc2, 0x00, 0x00, 0xc0, 0x29, 0x1a, 0xc3); +DEFINE_GUID(IID_IDirect3DRMFrame3, 0xff6b7f70, 0xa40e, 0x11d1, 0x91, 0xf9, 0x00, 0x00, 0xf8, 0x75, 0x8e, 0x66); +DEFINE_GUID(IID_IDirect3DRMVisual, 0xeb16cb04, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMesh, 0xa3a80d01, 0x6e12, 0x11cf, 0xac, 0x4a, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMeshBuilder, 0xa3a80d02, 0x6e12, 0x11cf, 0xac, 0x4a, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMeshBuilder2, 0x4516ec77, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMMeshBuilder3, 0x4516ec82, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMFace, 0xeb16cb07, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFace2, 0x4516ec81, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMLight, 0xeb16cb08, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMTexture, 0xeb16cb09, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMTexture2, 0x120f30c0, 0x1629, 0x11d0, 0x94, 0x1c, 0x00, 0x80, 0xc8, 0x0c, 0xfa, 0x7b); +DEFINE_GUID(IID_IDirect3DRMTexture3, 0xff6b7f73, 0xa40e, 0x11d1, 0x91, 0xf9, 0x00, 0x00, 0xf8, 0x75, 0x8e, 0x66); +DEFINE_GUID(IID_IDirect3DRMWrap, 0xeb16cb0a, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMaterial, 0xeb16cb0b, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMaterial2, 0xff6b7f75, 0xa40e, 0x11d1, 0x91, 0xf9, 0x00, 0x00, 0xf8, 0x75, 0x8e, 0x66); +DEFINE_GUID(IID_IDirect3DRMAnimation, 0xeb16cb0d, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMAnimation2, 0xff6b7f77, 0xa40e, 0x11d1, 0x91, 0xf9, 0x00, 0x00, 0xf8, 0x75, 0x8e, 0x66); +DEFINE_GUID(IID_IDirect3DRMAnimationSet, 0xeb16cb0e, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMAnimationSet2, 0xff6b7f79, 0xa40e, 0x11d1, 0x91, 0xf9, 0x00, 0x00, 0xf8, 0x75, 0x8e, 0x66); +DEFINE_GUID(IID_IDirect3DRMObjectArray, 0x242f6bc2, 0x3849, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMDeviceArray, 0xeb16cb10, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMViewportArray, 0xeb16cb11, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFrameArray, 0xeb16cb12, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMVisualArray, 0xeb16cb13, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMLightArray, 0xeb16cb14, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMPickedArray, 0xeb16cb16, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFaceArray, 0xeb16cb17, 0xd271, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMAnimationArray, 0xd5f1cae0, 0x4bd7, 0x11d1, 0xb9, 0x74, 0x00, 0x60, 0x08, 0x3e, 0x45, 0xf3); +DEFINE_GUID(IID_IDirect3DRMUserVisual, 0x59163de0, 0x6d43, 0x11cf, 0xac, 0x4a, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMShadow, 0xaf359780, 0x6ba3, 0x11cf, 0xac, 0x4a, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMShadow2, 0x86b44e25, 0x9c82, 0x11d1, 0xbb, 0x0b, 0x00, 0xa0, 0xc9, 0x81, 0xa0, 0xa6); +DEFINE_GUID(IID_IDirect3DRMInterpolator, 0x242f6bc1, 0x3849, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMProgressiveMesh, 0x4516ec79, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMPicked2Array, 0x4516ec7b, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMClippedVisual, 0x5434e733, 0x6d66, 0x11d1, 0xbb, 0x0b, 0x00, 0x00, 0xf8, 0x75, 0x86, 0x5a); + +/***************************************************************************** + * Predeclare the interfaces + */ + +typedef struct IDirect3DRMObject *LPDIRECT3DRMOBJECT, **LPLPDIRECT3DRMOBJECT; +typedef struct IDirect3DRMObject2 *LPDIRECT3DRMOBJECT2, **LPLPDIRECT3DRMOBJECT2; +typedef struct IDirect3DRMDevice *LPDIRECT3DRMDEVICE, **LPLPDIRECT3DRMDEVICE; +typedef struct IDirect3DRMDevice2 *LPDIRECT3DRMDEVICE2, **LPLPDIRECT3DRMDEVICE2; +typedef struct IDirect3DRMDevice3 *LPDIRECT3DRMDEVICE3, **LPLPDIRECT3DRMDEVICE3; +typedef struct IDirect3DRMViewport *LPDIRECT3DRMVIEWPORT, **LPLPDIRECT3DRMVIEWPORT; +typedef struct IDirect3DRMViewport2 *LPDIRECT3DRMVIEWPORT2, **LPLPDIRECT3DRMVIEWPORT2; +typedef struct IDirect3DRMFrame *LPDIRECT3DRMFRAME, **LPLPDIRECT3DRMFRAME; +typedef struct IDirect3DRMFrame2 *LPDIRECT3DRMFRAME2, **LPLPDIRECT3DRMFRAME2; +typedef struct IDirect3DRMFrame3 *LPDIRECT3DRMFRAME3, **LPLPDIRECT3DRMFRAME3; +typedef struct IDirect3DRMVisual *LPDIRECT3DRMVISUAL, **LPLPDIRECT3DRMVISUAL; +typedef struct IDirect3DRMMesh *LPDIRECT3DRMMESH, **LPLPDIRECT3DRMMESH; +typedef struct IDirect3DRMMeshBuilder *LPDIRECT3DRMMESHBUILDER, **LPLPDIRECT3DRMMESHBUILDER; +typedef struct IDirect3DRMMeshBuilder2 *LPDIRECT3DRMMESHBUILDER2, **LPLPDIRECT3DRMMESHBUILDER2; +typedef struct IDirect3DRMMeshBuilder3 *LPDIRECT3DRMMESHBUILDER3, **LPLPDIRECT3DRMMESHBUILDER3; +typedef struct IDirect3DRMFace *LPDIRECT3DRMFACE, **LPLPDIRECT3DRMFACE; +typedef struct IDirect3DRMFace2 *LPDIRECT3DRMFACE2, **LPLPDIRECT3DRMFACE2; +typedef struct IDirect3DRMLight *LPDIRECT3DRMLIGHT, **LPLPDIRECT3DRMLIGHT; +typedef struct IDirect3DRMTexture *LPDIRECT3DRMTEXTURE, **LPLPDIRECT3DRMTEXTURE; +typedef struct IDirect3DRMTexture2 *LPDIRECT3DRMTEXTURE2, **LPLPDIRECT3DRMTEXTURE2; +typedef struct IDirect3DRMTexture3 *LPDIRECT3DRMTEXTURE3, **LPLPDIRECT3DRMTEXTURE3; +typedef struct IDirect3DRMWrap *LPDIRECT3DRMWRAP, **LPLPDIRECT3DRMWRAP; +typedef struct IDirect3DRMMaterial *LPDIRECT3DRMMATERIAL, **LPLPDIRECT3DRMMATERIAL; +typedef struct IDirect3DRMMaterial2 *LPDIRECT3DRMMATERIAL2, **LPLPDIRECT3DRMMATERIAL2; +typedef struct IDirect3DRMAnimation *LPDIRECT3DRMANIMATION, **LPLPDIRECT3DRMANIMATION; +typedef struct IDirect3DRMAnimation2 *LPDIRECT3DRMANIMATION2, **LPLPDIRECT3DRMANIMATION2; +typedef struct IDirect3DRMAnimationSet *LPDIRECT3DRMANIMATIONSET, **LPLPDIRECT3DRMANIMATIONSET; +typedef struct IDirect3DRMAnimationSet2 *LPDIRECT3DRMANIMATIONSET2, **LPLPDIRECT3DRMANIMATIONSET2; +typedef struct IDirect3DRMUserVisual *LPDIRECT3DRMUSERVISUAL, **LPLPDIRECT3DRMUSERVISUAL; +typedef struct IDirect3DRMShadow *LPDIRECT3DRMSHADOW, **LPLPDIRECT3DRMSHADOW; +typedef struct IDirect3DRMShadow2 *LPDIRECT3DRMSHADOW2, **LPLPDIRECT3DRMSHADOW2; +typedef struct IDirect3DRMArray *LPDIRECT3DRMARRAY, **LPLPDIRECT3DRMARRAY; +typedef struct IDirect3DRMObjectArray *LPDIRECT3DRMOBJECTARRAY, **LPLPDIRECT3DRMOBJECTARRAY; +typedef struct IDirect3DRMDeviceArray *LPDIRECT3DRMDEVICEARRAY, **LPLPDIRECT3DRMDEVICEARRAY; +typedef struct IDirect3DRMFaceArray *LPDIRECT3DRMFACEARRAY, **LPLPDIRECT3DRMFACEARRAY; +typedef struct IDirect3DRMViewportArray *LPDIRECT3DRMVIEWPORTARRAY, **LPLPDIRECT3DRMVIEWPORTARRAY; +typedef struct IDirect3DRMFrameArray *LPDIRECT3DRMFRAMEARRAY, **LPLPDIRECT3DRMFRAMEARRAY; +typedef struct IDirect3DRMAnimationArray *LPDIRECT3DRMANIMATIONARRAY, **LPLPDIRECT3DRMANIMATIONARRAY; +typedef struct IDirect3DRMVisualArray *LPDIRECT3DRMVISUALARRAY, **LPLPDIRECT3DRMVISUALARRAY; +typedef struct IDirect3DRMPickedArray *LPDIRECT3DRMPICKEDARRAY, **LPLPDIRECT3DRMPICKEDARRAY; +typedef struct IDirect3DRMPicked2Array *LPDIRECT3DRMPICKED2ARRAY, **LPLPDIRECT3DRMPICKED2ARRAY; +typedef struct IDirect3DRMLightArray *LPDIRECT3DRMLIGHTARRAY, **LPLPDIRECT3DRMLIGHTARRAY; +typedef struct IDirect3DRMProgressiveMesh *LPDIRECT3DRMPROGRESSIVEMESH, **LPLPDIRECT3DRMPROGRESSIVEMESH; +typedef struct IDirect3DRMClippedVisual *LPDIRECT3DRMCLIPPEDVISUAL, **LPLPDIRECT3DRMCLIPPEDVISUAL; + +/* ******************************************************************** + Types and structures + ******************************************************************** */ + +typedef void (__cdecl *D3DRMOBJECTCALLBACK)(struct IDirect3DRMObject *obj, void *arg); +typedef void (__cdecl *D3DRMFRAMEMOVECALLBACK)(struct IDirect3DRMFrame *frame, void *ctx, D3DVALUE delta); +typedef void (__cdecl *D3DRMFRAME3MOVECALLBACK)(struct IDirect3DRMFrame3 *frame, void *ctx, D3DVALUE delta); +typedef void (__cdecl *D3DRMUPDATECALLBACK)(struct IDirect3DRMDevice *device, void *ctx, int count, D3DRECT *rects); +typedef void (__cdecl *D3DRMDEVICE3UPDATECALLBACK)(struct IDirect3DRMDevice3 *device, void *ctx, + int count, D3DRECT *rects); +typedef int (__cdecl *D3DRMUSERVISUALCALLBACK)(struct IDirect3DRMUserVisual *visual, void *ctx, + D3DRMUSERVISUALREASON reason, struct IDirect3DRMDevice *device, struct IDirect3DRMViewport *viewport); +typedef HRESULT (__cdecl *D3DRMLOADTEXTURECALLBACK)(char *tex_name, void *arg, struct IDirect3DRMTexture **texture); +typedef HRESULT (__cdecl *D3DRMLOADTEXTURE3CALLBACK)(char *tex_name, void *arg, struct IDirect3DRMTexture3 **texture); +typedef void (__cdecl *D3DRMLOADCALLBACK)(struct IDirect3DRMObject *object, REFIID objectguid, void *arg); +typedef HRESULT (__cdecl *D3DRMDOWNSAMPLECALLBACK)(struct IDirect3DRMTexture3 *texture, void *ctx, + IDirectDrawSurface *src_surface, IDirectDrawSurface *dst_surface); +typedef HRESULT (__cdecl *D3DRMVALIDATIONCALLBACK)(struct IDirect3DRMTexture3 *texture, void *ctx, + DWORD flags, DWORD rect_count, RECT *rects); + +typedef struct _D3DRMPICKDESC +{ + ULONG ulFaceIdx; + LONG lGroupIdx; + D3DVECTOR vPosition; +} D3DRMPICKDESC, *LPD3DRMPICKDESC; + +typedef struct _D3DRMPICKDESC2 +{ + ULONG ulFaceIdx; + LONG lGroupIdx; + D3DVECTOR vPosition; + D3DVALUE tu; + D3DVALUE tv; + D3DVECTOR dvNormal; + D3DCOLOR dcColor; +} D3DRMPICKDESC2, *LPD3DRMPICKDESC2; + +/***************************************************************************** + * IDirect3DRMObject interface + */ +#ifdef WINE_NO_UNICODE_MACROS +#undef GetClassName +#endif +#define INTERFACE IDirect3DRMObject +DECLARE_INTERFACE_(IDirect3DRMObject,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMObject_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMObject_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMObject_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMObject_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMObject_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMObject_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMObject_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMObject_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMObject_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMObject_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMObject_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMObject_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMObject_AddRef(p) (p)->AddRef() +#define IDirect3DRMObject_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMObject_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMObject_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMObject_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMObject_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMObject_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMObject_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMObject_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMObject_GetClassName(p,a,b) (p)->GetClassName(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMObject2 interface + */ +#ifdef WINE_NO_UNICODE_MACROS +#undef GetClassName +#endif +#define INTERFACE IDirect3DRMObject2 +DECLARE_INTERFACE_(IDirect3DRMObject2,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject2 methods ***/ + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(GetClientData)(THIS_ DWORD id, void **data) PURE; + STDMETHOD(GetDirect3DRM)(THIS_ struct IDirect3DRM **d3drm) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(SetClientData)(THIS_ DWORD id, void *data, DWORD flags) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetAge)(THIS_ DWORD flags, DWORD *age) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMObject2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMObject2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMObject2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject2 methods ***/ +#define IDirect3DRMObject2_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMObject2_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMObject2_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMObject2_GetClientData(p,a,b) (p)->lpVtbl->SetClientData(p,a,b) +#define IDirect3DRMObject2_GetDirect3DRM(p,a) (p)->lpVtbl->GetDirect3DRM(p,a) +#define IDirect3DRMObject2_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMObject2_SetClientData(p,a,b,c) (p)->lpVtbl->SetClientData(p,a,b,c) +#define IDirect3DRMObject2_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMObject2_GetAge(p,a,b) (p)->lpVtbl->GetAge(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMObject2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMObject2_AddRef(p) (p)->AddRef() +#define IDirect3DRMObject2_Release(p) (p)->Release() +/*** IDirect3DRMObject2 methods ***/ +#define IDirect3DRMObject2_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMObject2_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMObject2_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMObject2_GetClientData(p,a,b) (p)->SetClientData(a,b) +#define IDirect3DRMObject2_GetDirect3DRM(p,a) (p)->GetDirect3DRM(a) +#define IDirect3DRMObject2_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMObject2_SetClientData(p,a,b,c) (p)->SetClientData(a,b,c) +#define IDirect3DRMObject2_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMObject2_GetAge(p,a,b) (p)->GetAge(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMVisual interface + */ +#define INTERFACE IDirect3DRMVisual +DECLARE_INTERFACE_(IDirect3DRMVisual,IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMVisual_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMVisual_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMVisual_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMVisual_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMVisual_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMVisual_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMVisual_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMVisual_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMVisual_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMVisual_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMVisual_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMVisual_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMVisual_AddRef(p) (p)->AddRef() +#define IDirect3DRMVisual_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMVisual_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMVisual_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMVisual_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMVisual_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMVisual_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMVisual_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMVisual_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMVisual_GetClassName(p,a,b) (p)->GetClassName(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMDevice interface + */ +#ifdef WINE_NO_UNICODE_MACROS +#undef GetClassName +#endif +#define INTERFACE IDirect3DRMDevice +DECLARE_INTERFACE_(IDirect3DRMDevice,IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMDevice methods ***/ + STDMETHOD(Init)(THIS_ ULONG width, ULONG height) PURE; + STDMETHOD(InitFromD3D)(THIS_ IDirect3D *d3d, IDirect3DDevice *d3d_device) PURE; + STDMETHOD(InitFromClipper)(THIS_ IDirectDrawClipper *clipper, GUID *guid, int width, int height) PURE; + STDMETHOD(Update)(THIS) PURE; + STDMETHOD(AddUpdateCallback)(THIS_ D3DRMUPDATECALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteUpdateCallback)(THIS_ D3DRMUPDATECALLBACK cb, void *ctx) PURE; + STDMETHOD(SetBufferCount)(THIS_ DWORD) PURE; + STDMETHOD_(DWORD, GetBufferCount)(THIS) PURE; + STDMETHOD(SetDither)(THIS_ BOOL) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetTextureQuality)(THIS_ D3DRMTEXTUREQUALITY) PURE; + STDMETHOD(GetViewports)(THIS_ struct IDirect3DRMViewportArray **array) PURE; + STDMETHOD_(BOOL, GetDither)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetTrianglesDrawn)(THIS) PURE; + STDMETHOD_(DWORD, GetWireframeOptions)(THIS) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(D3DCOLORMODEL, GetColorModel)(THIS) PURE; + STDMETHOD_(D3DRMTEXTUREQUALITY, GetTextureQuality)(THIS) PURE; + STDMETHOD(GetDirect3DDevice)(THIS_ IDirect3DDevice **d3d_device) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMDevice_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMDevice_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMDevice_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMDevice_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMDevice_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMDevice_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMDevice_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMDevice_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMDevice_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMDevice_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMDevice methods ***/ +#define IDirect3DRMDevice_Init(p,a,b) (p)->lpVtbl->Init(p,a,b) +#define IDirect3DRMDevice_InitFromD3D(p,a,b) (p)->lpVtbl->InitFromD3D(p,a,b) +#define IDirect3DRMDevice_InitFromClipper(p,a,b,c,d) (p)->lpVtbl->InitFromClipper(p,a,b,c,d) +#define IDirect3DRMDevice_Update(p) (p)->lpVtbl->Update(p) +#define IDirect3DRMDevice_AddUpdateCallback(p,a,b) (p)->lpVtbl->AddUpdateCallback(p,a,b) +#define IDirect3DRMDevice_DeleteUpdateCallback(p,a,b) (p)->lpVtbl->DeleteUpdateCallback(p,a,b) +#define IDirect3DRMDevice_SetBufferCount(p,a) (p)->lpVtbl->SetBufferCount(p,a) +#define IDirect3DRMDevice_GetBufferCount(p) (p)->lpVtbl->GetBufferCount(p) +#define IDirect3DRMDevice_SetDither(p,a) (p)->lpVtbl->SetDither(p,a) +#define IDirect3DRMDevice_SetShades(p,a) (p)->lpVtbl->SetShades(p,a) +#define IDirect3DRMDevice_SetQuality(p,a) (p)->lpVtbl->SetQuality(p,a) +#define IDirect3DRMDevice_SetTextureQuality(p,a) (p)->lpVtbl->SetTextureQuality(p,a) +#define IDirect3DRMDevice_GetViewports(p,a) (p)->lpVtbl->GetViewports(p,a) +#define IDirect3DRMDevice_GetDither(p) (p)->lpVtbl->GetDither(p) +#define IDirect3DRMDevice_GetShades(p) (p)->lpVtbl->GetShades(p) +#define IDirect3DRMDevice_GetHeight(p) (p)->lpVtbl->GetHeight(p) +#define IDirect3DRMDevice_GetWidth(p) (p)->lpVtbl->GetWidth(p) +#define IDirect3DRMDevice_GetTrianglesDrawn(p) (p)->lpVtbl->GetTrianglesDrawn(p) +#define IDirect3DRMDevice_GetWireframeOptions(p) (p)->lpVtbl->GetWireframeOptions(p) +#define IDirect3DRMDevice_GetQuality(p) (p)->lpVtbl->GetQuality(p) +#define IDirect3DRMDevice_GetColorModel(p) (p)->lpVtbl->GetColorModel(p) +#define IDirect3DRMDevice_GetTextureQuality(p) (p)->lpVtbl->GetTextureQuality(p) +#define IDirect3DRMDevice_GetDirect3DDevice(p,a) (p)->lpVtbl->GetDirect3DDevice(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMDevice_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMDevice_AddRef(p) (p)->AddRef() +#define IDirect3DRMDevice_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMDevice_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMDevice_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMDevice_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMDevice_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMDevice_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMDevice_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMDevice_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMDevice_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMDevice methods ***/ +#define IDirect3DRMDevice_Init(p,a,b) (p)->Init(a,b) +#define IDirect3DRMDevice_InitFromD3D(p,a,b) (p)->InitFromD3D(a,b) +#define IDirect3DRMDevice_InitFromClipper(p,a,b,c,d) (p)->InitFromClipper(a,b,c,d) +#define IDirect3DRMDevice_Update(p) (p)->Update() +#define IDirect3DRMDevice_AddUpdateCallback(p,a,b) (p)->AddUpdateCallback(a,b) +#define IDirect3DRMDevice_DeleteUpdateCallback(p,a,b) (p)->DeleteUpdateCallback(a,b) +#define IDirect3DRMDevice_SetBufferCount(p,a) (p)->SetBufferCount(a) +#define IDirect3DRMDevice_GetBufferCount(p) (p)->GetBufferCount() +#define IDirect3DRMDevice_SetDither(p,a) (p)->SetDither(a) +#define IDirect3DRMDevice_SetShades(p,a) (p)->SetShades(a) +#define IDirect3DRMDevice_SetQuality(p,a) (p)->SetQuality(a) +#define IDirect3DRMDevice_SetTextureQuality(p,a) (p)->SetTextureQuality(a) +#define IDirect3DRMDevice_GetViewports(p,a) (p)->GetViewports(a) +#define IDirect3DRMDevice_GetDither(p) (p)->GetDither() +#define IDirect3DRMDevice_GetShades(p) (p)->GetShades() +#define IDirect3DRMDevice_GetHeight(p) (p)->GetHeight() +#define IDirect3DRMDevice_GetWidth(p) (p)->GetWidth() +#define IDirect3DRMDevice_GetTrianglesDrawn(p) (p)->GetTrianglesDrawn() +#define IDirect3DRMDevice_GetWireframeOptions(p) (p)->GetWireframeOptions() +#define IDirect3DRMDevice_GetQuality(p) (p)->GetQuality() +#define IDirect3DRMDevice_GetColorModel(p) (p)->GetColorModel() +#define IDirect3DRMDevice_GetTextureQuality(p) (p)->GetTextureQuality() +#define IDirect3DRMDevice_GetDirect3DDevice(p,a) (p)->GetDirect3DDevice(a) +#endif + +/***************************************************************************** + * IDirect3DRMDevice2 interface + */ +#ifdef WINE_NO_UNICODE_MACROS +#undef GetClassName +#endif +#define INTERFACE IDirect3DRMDevice2 +DECLARE_INTERFACE_(IDirect3DRMDevice2,IDirect3DRMDevice) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMDevice methods ***/ + STDMETHOD(Init)(THIS_ ULONG width, ULONG height) PURE; + STDMETHOD(InitFromD3D)(THIS_ IDirect3D *d3d, IDirect3DDevice *d3d_device) PURE; + STDMETHOD(InitFromClipper)(THIS_ IDirectDrawClipper *clipper, GUID *guid, int width, int height) PURE; + STDMETHOD(Update)(THIS) PURE; + STDMETHOD(AddUpdateCallback)(THIS_ D3DRMUPDATECALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteUpdateCallback)(THIS_ D3DRMUPDATECALLBACK cb, void *ctx) PURE; + STDMETHOD(SetBufferCount)(THIS_ DWORD) PURE; + STDMETHOD_(DWORD, GetBufferCount)(THIS) PURE; + STDMETHOD(SetDither)(THIS_ BOOL) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetTextureQuality)(THIS_ D3DRMTEXTUREQUALITY) PURE; + STDMETHOD(GetViewports)(THIS_ struct IDirect3DRMViewportArray **array) PURE; + STDMETHOD_(BOOL, GetDither)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetTrianglesDrawn)(THIS) PURE; + STDMETHOD_(DWORD, GetWireframeOptions)(THIS) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(D3DCOLORMODEL, GetColorModel)(THIS) PURE; + STDMETHOD_(D3DRMTEXTUREQUALITY, GetTextureQuality)(THIS) PURE; + STDMETHOD(GetDirect3DDevice)(THIS_ IDirect3DDevice **d3d_device) PURE; + /*** IDirect3DRMDevice2 methods ***/ + STDMETHOD(InitFromD3D2)(THIS_ IDirect3D2 *d3d, IDirect3DDevice2 *device) PURE; + STDMETHOD(InitFromSurface)(THIS_ GUID *guid, IDirectDraw *ddraw, IDirectDrawSurface *surface) PURE; + STDMETHOD(SetRenderMode)(THIS_ DWORD flags) PURE; + STDMETHOD_(DWORD, GetRenderMode)(THIS) PURE; + STDMETHOD(GetDirect3DDevice2)(THIS_ IDirect3DDevice2 **device) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMDevice2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMDevice2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMDevice2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMDevice2_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMDevice2_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMDevice2_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMDevice2_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMDevice2_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMDevice2_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMDevice2_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMDevice2_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMDevice methods ***/ +#define IDirect3DRMDevice2_Init(p,a,b) (p)->lpVtbl->Init(p,a,b) +#define IDirect3DRMDevice2_InitFromD3D(p,a,b) (p)->lpVtbl->InitFromD3D(p,a,b) +#define IDirect3DRMDevice2_InitFromClipper(p,a,b,c,d) (p)->lpVtbl->InitFromClipper(p,a,b,c,d) +#define IDirect3DRMDevice2_Update(p) (p)->lpVtbl->Update(p) +#define IDirect3DRMDevice2_AddUpdateCallback(p,a,b) (p)->lpVtbl->AddUpdateCallback(p,a,b) +#define IDirect3DRMDevice2_DeleteUpdateCallback(p,a,b) (p)->lpVtbl->DeleteUpdateCallback(p,a,b) +#define IDirect3DRMDevice2_SetBufferCount(p,a) (p)->lpVtbl->SetBufferCount(p,a) +#define IDirect3DRMDevice2_GetBufferCount(p) (p)->lpVtbl->GetBufferCount(p) +#define IDirect3DRMDevice2_SetDither(p,a) (p)->lpVtbl->SetDither(p,a) +#define IDirect3DRMDevice2_SetShades(p,a) (p)->lpVtbl->SetShades(p,a) +#define IDirect3DRMDevice2_SetQuality(p,a) (p)->lpVtbl->SetQuality(p,a) +#define IDirect3DRMDevice2_SetTextureQuality(p,a) (p)->lpVtbl->SetTextureQuality(p,a) +#define IDirect3DRMDevice2_GetViewports(p,a) (p)->lpVtbl->GetViewports(p,a) +#define IDirect3DRMDevice2_GetDither(p) (p)->lpVtbl->GetDither(p) +#define IDirect3DRMDevice2_GetShades(p) (p)->lpVtbl->GetShades(p) +#define IDirect3DRMDevice2_GetHeight(p) (p)->lpVtbl->GetHeight(p) +#define IDirect3DRMDevice2_GetWidth(p) (p)->lpVtbl->GetWidth(p) +#define IDirect3DRMDevice2_GetTrianglesDrawn(p) (p)->lpVtbl->GetTrianglesDrawn(p) +#define IDirect3DRMDevice2_GetWireframeOptions(p) (p)->lpVtbl->GetWireframeOptions(p) +#define IDirect3DRMDevice2_GetQuality(p) (p)->lpVtbl->GetQuality(p) +#define IDirect3DRMDevice2_GetColorModel(p) (p)->lpVtbl->GetColorModel(p) +#define IDirect3DRMDevice2_GetTextureQuality(p) (p)->lpVtbl->GetTextureQuality(p) +#define IDirect3DRMDevice2_GetDirect3DDevice(p,a) (p)->lpVtbl->GetDirect3DDevice(p,a) +/*** IDirect3DRMDevice2 methods ***/ +#define IDirect3DRMDevice2_InitFromD3D2(p,a,b) (p)->lpVtbl->InitFromD3D2(p,a,b) +#define IDirect3DRMDevice2_InitFromSurface(p,a,b,c) (p)->lpVtbl->InitFromSurface(p,a,b,c) +#define IDirect3DRMDevice2_SetRenderMode(p,a) (p)->lpVtbl->SetRenderMode(p,a) +#define IDirect3DRMDevice2_GetRenderMode(p) (p)->lpVtbl->GetRenderMode(p) +#define IDirect3DRMDevice2_GetDirect3DDevice2(p,a) (p)->lpVtbl->GetDirect3DDevice2(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMDevice2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMDevice2_AddRef(p) (p)->AddRef() +#define IDirect3DRMDevice2_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMDevice2_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMDevice2_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMDevice2_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMDevice2_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMDevice2_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMDevice2_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMDevice2_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMDevice2_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMDevice methods ***/ +#define IDirect3DRMDevice2_Init(p,a,b) (p)->Init(a,b) +#define IDirect3DRMDevice2_InitFromD3D(p,a,b) (p)->InitFromD3D(a,b) +#define IDirect3DRMDevice2_InitFromClipper(p,a,b,c,d) (p)->InitFromClipper(a,b,c,d) +#define IDirect3DRMDevice2_Update(p) (p)->Update() +#define IDirect3DRMDevice2_AddUpdateCallback(p,a,b) (p)->AddUpdateCallback(a,b) +#define IDirect3DRMDevice2_DeleteUpdateCallback(p,a,b) (p)->DeleteUpdateCallback(a,b) +#define IDirect3DRMDevice2_SetBufferCount(p,a) (p)->SetBufferCount(a) +#define IDirect3DRMDevice2_GetBufferCount(p) (p)->GetBufferCount() +#define IDirect3DRMDevice2_SetDither(p,a) (p)->SetDither(a) +#define IDirect3DRMDevice2_SetShades(p,a) (p)->SetShades(a) +#define IDirect3DRMDevice2_SetQuality(p,a) (p)->SetQuality(a) +#define IDirect3DRMDevice2_SetTextureQuality(p,a) (p)->SetTextureQuality(a) +#define IDirect3DRMDevice2_GetViewports(p,a) (p)->GetViewports(a) +#define IDirect3DRMDevice2_GetDither(p) (p)->GetDither() +#define IDirect3DRMDevice2_GetShades(p) (p)->GetShades() +#define IDirect3DRMDevice2_GetHeight(p) (p)->GetHeight() +#define IDirect3DRMDevice2_GetWidth(p) (p)->GetWidth() +#define IDirect3DRMDevice2_GetTrianglesDrawn(p) (p)->GetTrianglesDrawn() +#define IDirect3DRMDevice2_GetWireframeOptions(p) (p)->GetWireframeOptions() +#define IDirect3DRMDevice2_GetQuality(p) (p)->GetQuality() +#define IDirect3DRMDevice2_GetColorModel(p) (p)->GetColorModel() +#define IDirect3DRMDevice2_GetTextureQuality(p) (p)->GetTextureQuality() +#define IDirect3DRMDevice2_GetDirect3DDevice(p,a) (p)->GetDirect3DDevice(a) +/*** IDirect3DRMDevice2 methods ***/ +#define IDirect3DRMDevice2_InitFromD3D2(p,a,b) (p)->InitFromD3D2(a,b) +#define IDirect3DRMDevice2_InitFromSurface(p,a,b,c) (p)->InitFromSurface(a,b,c) +#define IDirect3DRMDevice2_SetRenderMode(p,a) (p)->SetRenderMode(a) +#define IDirect3DRMDevice2_GetRenderMode(p) (p)->GetRenderMode() +#define IDirect3DRMDevice2_GetDirect3DDevice2(p,a) (p)->GetDirect3DDevice2(a) +#endif + +/***************************************************************************** + * IDirect3DRMDevice3 interface + */ +#ifdef WINE_NO_UNICODE_MACROS +#undef GetClassName +#endif +#define INTERFACE IDirect3DRMDevice3 +DECLARE_INTERFACE_(IDirect3DRMDevice3,IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMDevice methods ***/ + STDMETHOD(Init)(THIS_ ULONG width, ULONG height) PURE; + STDMETHOD(InitFromD3D)(THIS_ IDirect3D *d3d, IDirect3DDevice *d3d_device) PURE; + STDMETHOD(InitFromClipper)(THIS_ IDirectDrawClipper *clipper, GUID *guid, int width, int height) PURE; + STDMETHOD(Update)(THIS) PURE; + STDMETHOD(AddUpdateCallback)(THIS_ D3DRMUPDATECALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteUpdateCallback)(THIS_ D3DRMUPDATECALLBACK cb, void *ctx) PURE; + STDMETHOD(SetBufferCount)(THIS_ DWORD) PURE; + STDMETHOD_(DWORD, GetBufferCount)(THIS) PURE; + STDMETHOD(SetDither)(THIS_ BOOL) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetTextureQuality)(THIS_ D3DRMTEXTUREQUALITY) PURE; + STDMETHOD(GetViewports)(THIS_ struct IDirect3DRMViewportArray **array) PURE; + STDMETHOD_(BOOL, GetDither)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetTrianglesDrawn)(THIS) PURE; + STDMETHOD_(DWORD, GetWireframeOptions)(THIS) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(D3DCOLORMODEL, GetColorModel)(THIS) PURE; + STDMETHOD_(D3DRMTEXTUREQUALITY, GetTextureQuality)(THIS) PURE; + STDMETHOD(GetDirect3DDevice)(THIS_ IDirect3DDevice **d3d_device) PURE; + /*** IDirect3DRMDevice2 methods ***/ + STDMETHOD(InitFromD3D2)(THIS_ IDirect3D2 *d3d, IDirect3DDevice2 *device) PURE; + STDMETHOD(InitFromSurface)(THIS_ GUID *guid, IDirectDraw *ddraw, IDirectDrawSurface *surface) PURE; + STDMETHOD(SetRenderMode)(THIS_ DWORD flags) PURE; + STDMETHOD_(DWORD, GetRenderMode)(THIS) PURE; + STDMETHOD(GetDirect3DDevice2)(THIS_ IDirect3DDevice2 **device) PURE; + /*** IDirect3DRMDevice3 methods ***/ + STDMETHOD(FindPreferredTextureFormat)(THIS_ DWORD BitDepths, DWORD flags, DDPIXELFORMAT *format) PURE; + STDMETHOD(RenderStateChange)(THIS_ D3DRENDERSTATETYPE drsType, DWORD val, DWORD flags) PURE; + STDMETHOD(LightStateChange)(THIS_ D3DLIGHTSTATETYPE drsType, DWORD val, DWORD flags) PURE; + STDMETHOD(GetStateChangeOptions)(THIS_ DWORD state_class, DWORD state_idx, DWORD *flags) PURE; + STDMETHOD(SetStateChangeOptions)(THIS_ DWORD StateClass, DWORD StateNum, DWORD flags) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMDevice3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMDevice3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMDevice3_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMDevice3_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMDevice3_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMDevice3_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMDevice3_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMDevice3_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMDevice3_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMDevice3_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMDevice3_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMDevice methods ***/ +#define IDirect3DRMDevice3_Init(p,a,b) (p)->lpVtbl->Init(p,a,b) +#define IDirect3DRMDevice3_InitFromD3D(p,a,b) (p)->lpVtbl->InitFromD3D(p,a,b) +#define IDirect3DRMDevice3_InitFromClipper(p,a,b,c,d) (p)->lpVtbl->InitFromClipper(p,a,b,c,d) +#define IDirect3DRMDevice3_Update(p) (p)->lpVtbl->Update(p) +#define IDirect3DRMDevice3_AddUpdateCallback(p,a,b) (p)->lpVtbl->AddUpdateCallback(p,a,b) +#define IDirect3DRMDevice3_DeleteUpdateCallback(p,a,b) (p)->lpVtbl->DeleteUpdateCallback(p,a,b) +#define IDirect3DRMDevice3_SetBufferCount(p,a) (p)->lpVtbl->SetBufferCount(p,a) +#define IDirect3DRMDevice3_GetBufferCount(p) (p)->lpVtbl->GetBufferCount(p) +#define IDirect3DRMDevice3_SetDither(p,a) (p)->lpVtbl->SetDither(p,a) +#define IDirect3DRMDevice3_SetShades(p,a) (p)->lpVtbl->SetShades(p,a) +#define IDirect3DRMDevice3_SetQuality(p,a) (p)->lpVtbl->SetQuality(p,a) +#define IDirect3DRMDevice3_SetTextureQuality(p,a) (p)->lpVtbl->SetTextureQuality(p,a) +#define IDirect3DRMDevice3_GetViewports(p,a) (p)->lpVtbl->GetViewports(p,a) +#define IDirect3DRMDevice3_GetDither(p) (p)->lpVtbl->GetDither(p) +#define IDirect3DRMDevice3_GetShades(p) (p)->lpVtbl->GetShades(p) +#define IDirect3DRMDevice3_GetHeight(p) (p)->lpVtbl->GetHeight(p) +#define IDirect3DRMDevice3_GetWidth(p) (p)->lpVtbl->GetWidth(p) +#define IDirect3DRMDevice3_GetTrianglesDrawn(p) (p)->lpVtbl->GetTrianglesDrawn(p) +#define IDirect3DRMDevice3_GetWireframeOptions(p) (p)->lpVtbl->GetWireframeOptions(p) +#define IDirect3DRMDevice3_GetQuality(p) (p)->lpVtbl->GetQuality(p) +#define IDirect3DRMDevice3_GetColorModel(p) (p)->lpVtbl->GetColorModel(p) +#define IDirect3DRMDevice3_GetTextureQuality(p) (p)->lpVtbl->GetTextureQuality(p) +#define IDirect3DRMDevice3_GetDirect3DDevice(p,a) (p)->lpVtbl->GetDirect3DDevice(p,a) +/*** IDirect3DRMDevice2 methods ***/ +#define IDirect3DRMDevice3_InitFromD3D2(p,a,b) (p)->lpVtbl->InitFromD3D2(p,a,b) +#define IDirect3DRMDevice3_InitFromSurface(p,a,b,c) (p)->lpVtbl->InitFromSurface(p,a,b,c) +#define IDirect3DRMDevice3_SetRenderMode(p,a) (p)->lpVtbl->SetRenderMode(p,a) +#define IDirect3DRMDevice3_GetRenderMode(p) (p)->lpVtbl->GetRenderMode(p) +#define IDirect3DRMDevice3_GetDirect3DDevice2(p,a) (p)->lpVtbl->GetDirect3DDevice2(p,a) +/*** IDirect3DRMDevice3 methods ***/ +#define IDirect3DRMDevice3_FindPreferredTextureFormat(p,a,b,c) (p)->lpVtbl->FindPreferredTextureFormat(p,a,b,c) +#define IDirect3DRMDevice3_RenderStateChange(p,a,b,c) (p)->lpVtbl->RenderStateChange(p,a,b,c) +#define IDirect3DRMDevice3_LightStateChange(p,a,b,c) (p)->lpVtbl->LightStateChange(p,a,b,c) +#define IDirect3DRMDevice3_GetStateChangeOptions(p,a,b,c) (p)->lpVtbl->GetStateChangeOptions(p,a,b,c) +#define IDirect3DRMDevice3_SetStateChangeOptions(p,a,b,c) (p)->lpVtbl->SetStateChangeOptions(p,a,b,c) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMDevice3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMDevice3_AddRef(p) (p)->AddRef() +#define IDirect3DRMDevice3_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMDevice3_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMDevice3_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMDevice3_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMDevice3_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMDevice3_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMDevice3_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMDevice3_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMDevice3_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMDevice methods ***/ +#define IDirect3DRMDevice3_Init(p,a,b) (p)->Init(a,b) +#define IDirect3DRMDevice3_InitFromD3D(p,a,b) (p)->InitFromD3D(a,b) +#define IDirect3DRMDevice3_InitFromClipper(p,a,b,c,d) (p)->InitFromClipper(a,b,c,d) +#define IDirect3DRMDevice3_Update(p) (p)->Update() +#define IDirect3DRMDevice3_AddUpdateCallback(p,a,b) (p)->AddUpdateCallback(a,b) +#define IDirect3DRMDevice3_DeleteUpdateCallback(p,a,b) (p)->DeleteUpdateCallback(a,b) +#define IDirect3DRMDevice3_SetBufferCount(p,a) (p)->SetBufferCount(a) +#define IDirect3DRMDevice3_GetBufferCount(p) (p)->GetBufferCount() +#define IDirect3DRMDevice3_SetDither(p,a) (p)->SetDither(a) +#define IDirect3DRMDevice3_SetShades(p,a) (p)->SetShades(a) +#define IDirect3DRMDevice3_SetQuality(p,a) (p)->SetQuality(a) +#define IDirect3DRMDevice3_SetTextureQuality(p,a) (p)->SetTextureQuality(a) +#define IDirect3DRMDevice3_GetViewports(p,a) (p)->GetViewports(a) +#define IDirect3DRMDevice3_GetDither(p) (p)->GetDither() +#define IDirect3DRMDevice3_GetShades(p) (p)->GetShades() +#define IDirect3DRMDevice3_GetHeight(p) (p)->GetHeight() +#define IDirect3DRMDevice3_GetWidth(p) (p)->GetWidth() +#define IDirect3DRMDevice3_GetTrianglesDrawn(p) (p)->GetTrianglesDrawn() +#define IDirect3DRMDevice3_GetWireframeOptions(p) (p)->GetWireframeOptions() +#define IDirect3DRMDevice3_GetQuality(p) (p)->GetQuality() +#define IDirect3DRMDevice3_GetColorModel(p) (p)->GetColorModel() +#define IDirect3DRMDevice3_GetTextureQuality(p) (p)->GetTextureQuality() +#define IDirect3DRMDevice3_GetDirect3DDevice(p,a) (p)->GetDirect3DDevice(a) +/*** IDirect3DRMDevice2 methods ***/ +#define IDirect3DRMDevice3_InitFromD3D2(p,a,b) (p)->InitFromD3D2(a,b) +#define IDirect3DRMDevice3_InitFromSurface(p,a,b,c) (p)->InitFromSurface(a,b,c) +#define IDirect3DRMDevice3_SetRenderMode(p,a) (p)->SetRenderMode(a) +#define IDirect3DRMDevice3_GetRenderMode(p) (p)->GetRenderMode() +#define IDirect3DRMDevice3_GetDirect3DDevice2(p,a) (p)->GetDirect3DDevice2(a) +/*** IDirect3DRMDevice3 methods ***/ +#define IDirect3DRMDevice3_FindPreferredTextureFormat(p,a,b,c) (p)->FindPreferredTextureFormat(a,b,c) +#define IDirect3DRMDevice3_RenderStateChange(p,a,b,c) (p)->RenderStateChange(a,b,c) +#define IDirect3DRMDevice3_LightStateChange(p,a,b,c) (p)->LightStateChange(a,b,c) +#define IDirect3DRMDevice3_GetStateChangeOptions(p,a,b,c) (p)->GetStateChangeOptions(a,b,c) +#define IDirect3DRMDevice3_SetStateChangeOptions(p,a,b,c) (p)->SetStateChangeOptions(a,b,c) +#endif + +/***************************************************************************** + * IDirect3DRMViewport interface + */ +#define INTERFACE IDirect3DRMViewport +DECLARE_INTERFACE_(IDirect3DRMViewport,IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMViewport methods ***/ + STDMETHOD(Init) (THIS_ IDirect3DRMDevice *device, struct IDirect3DRMFrame *camera, + DWORD x, DWORD y, DWORD width, DWORD height) PURE; + STDMETHOD(Clear)(THIS) PURE; + STDMETHOD(Render)(THIS_ struct IDirect3DRMFrame *frame) PURE; + STDMETHOD(SetFront)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetBack)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetField)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetUniformScaling)(THIS_ BOOL) PURE; + STDMETHOD(SetCamera)(THIS_ struct IDirect3DRMFrame *camera) PURE; + STDMETHOD(SetProjection)(THIS_ D3DRMPROJECTIONTYPE) PURE; + STDMETHOD(Transform)(THIS_ D3DRMVECTOR4D *d, D3DVECTOR *s) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DRMVECTOR4D *s) PURE; + STDMETHOD(Configure)(THIS_ LONG x, LONG y, DWORD width, DWORD height) PURE; + STDMETHOD(ForceUpdate)(THIS_ DWORD x1, DWORD y1, DWORD x2, DWORD y2) PURE; + STDMETHOD(SetPlane)(THIS_ D3DVALUE left, D3DVALUE right, D3DVALUE bottom, D3DVALUE top) PURE; + STDMETHOD(GetCamera)(THIS_ struct IDirect3DRMFrame **camera) PURE; + STDMETHOD(GetDevice)(THIS_ IDirect3DRMDevice **device) PURE; + STDMETHOD(GetPlane)(THIS_ D3DVALUE *left, D3DVALUE *right, D3DVALUE *bottom, D3DVALUE *top) PURE; + STDMETHOD(Pick)(THIS_ LONG x, LONG y, struct IDirect3DRMPickedArray **visuals) PURE; + STDMETHOD_(BOOL, GetUniformScaling)(THIS) PURE; + STDMETHOD_(LONG, GetX)(THIS) PURE; + STDMETHOD_(LONG, GetY)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetField)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetBack)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetFront)(THIS) PURE; + STDMETHOD_(D3DRMPROJECTIONTYPE, GetProjection)(THIS) PURE; + STDMETHOD(GetDirect3DViewport)(THIS_ IDirect3DViewport **viewport) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMViewport_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMViewport_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMViewport_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMViewport_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMViewport_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMViewport_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMViewport_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMViewport_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMViewport_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMViewport_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMViewport_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMViewport methods ***/ +#define IDirect3DRMViewport_Init(p,a,b,c,d,e,f) (p)->lpVtbl->Init(p,a,b,c,d,e,f) +#define IDirect3DRMViewport_Clear(p) (p)->lpVtbl->Clear(p) +#define IDirect3DRMViewport_Render(p,a) (p)->lpVtbl->Render(p,a) +#define IDirect3DRMViewport_SetFront(p,a) (p)->lpVtbl->SetFront(p,a) +#define IDirect3DRMViewport_SetBack(p,a) (p)->lpVtbl->SetBack(p,a) +#define IDirect3DRMViewport_SetField(p,a) (p)->lpVtbl->SetField(p,a) +#define IDirect3DRMViewport_SetUniformScaling(p,a) (p)->lpVtbl->SetUniformScaling(p,a) +#define IDirect3DRMViewport_SetCamera(p,a) (p)->lpVtbl->SetCamera(p,a) +#define IDirect3DRMViewport_SetProjection(p,a) (p)->lpVtbl->SetProjection(p,a) +#define IDirect3DRMViewport_Transform(p,a,b) (p)->lpVtbl->Transform(p,a,b) +#define IDirect3DRMViewport_InverseTransform(p,a,b) (p)->lpVtbl->InverseTransform(p,a,b) +#define IDirect3DRMViewport_Configure(p,a,b,c,d) (p)->lpVtbl->Configure(p,a,b,c,d) +#define IDirect3DRMViewport_ForceUpdate(p,a,b,c,d) (p)->lpVtbl->ForceUpdate(p,a,b,c,d) +#define IDirect3DRMViewport_SetPlane(p,a,b,c,d) (p)->lpVtbl->SetPlane(p,a,b,c,d) +#define IDirect3DRMViewport_GetCamera(p,a) (p)->lpVtbl->GetCamera(p,a) +#define IDirect3DRMViewport_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DRMViewport_GetPlane(p,a,b,c,d) (p)->lpVtbl->GetPlane(p,a,b,c,d) +#define IDirect3DRMViewport_Pick(p,a,b,c) (p)->lpVtbl->Pick(p,a,b,c) +#define IDirect3DRMViewport_GetUniformScaling(p) (p)->lpVtbl->GetUniformScaling(p) +#define IDirect3DRMViewport_GetX(p) (p)->lpVtbl->GetX(p) +#define IDirect3DRMViewport_GetY(p) (p)->lpVtbl->GetY(p) +#define IDirect3DRMViewport_GetWidth(p) (p)->lpVtbl->GetWidth(p) +#define IDirect3DRMViewport_GetHeight(p) (p)->lpVtbl->GetHeight(p) +#define IDirect3DRMViewport_GetField(p) (p)->lpVtbl->GetField(p) +#define IDirect3DRMViewport_GetBack(p) (p)->lpVtbl->GetBack(p) +#define IDirect3DRMViewport_GetFront(p) (p)->lpVtbl->GetFront(p) +#define IDirect3DRMViewport_GetProjection(p) (p)->lpVtbl->GetProjection(p) +#define IDirect3DRMViewport_GetDirect3DViewport(p,a) (p)->lpVtbl->GetDirect3DViewport(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMViewport_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMViewport_AddRef(p) (p)->AddRef() +#define IDirect3DRMViewport_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMViewport_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMViewport_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMViewport_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMViewport_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMViewport_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMViewport_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMViewport_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMViewport_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMViewport methods ***/ +#define IDirect3DRMViewport_Init(p,a,b,c,d,e,f) (p)->Init(a,b,c,d,e,f) +#define IDirect3DRMViewport_Clear(p) (p)->Clear() +#define IDirect3DRMViewport_Render(p,a) (p)->Render(a) +#define IDirect3DRMViewport_SetFront(p,a) (p)->SetFront(a) +#define IDirect3DRMViewport_SetBack(p,a) (p)->SetBack(a) +#define IDirect3DRMViewport_SetField(p,a) (p)->SetField(a) +#define IDirect3DRMViewport_SetUniformScaling(p,a) (p)->SetUniformScaling(a) +#define IDirect3DRMViewport_SetCamera(p,a) (p)->SetCamera(a) +#define IDirect3DRMViewport_SetProjection(p,a) (p)->SetProjection(a) +#define IDirect3DRMViewport_Transform(p,a,b) (p)->Transform(a,b) +#define IDirect3DRMViewport_InverseTransform(p,a,b) (p)->InverseTransform(a,b) +#define IDirect3DRMViewport_Configure(p,a,b,c,d) (p)->Configure(a,b,c,d) +#define IDirect3DRMViewport_ForceUpdate(p,a,b,c,d) (p)->ForceUpdate(a,b,c,d) +#define IDirect3DRMViewport_SetPlane(p,a,b,c,d) (p)->SetPlane(a,b,c,d) +#define IDirect3DRMViewport_GetCamera(p,a) (p)->GetCamera(a) +#define IDirect3DRMViewport_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DRMViewport_GetPlane(p,a,b,c,d) (p)->GetPlane(a,b,c,d) +#define IDirect3DRMViewport_Pick(p,a,b,c) (p)->Pick(a,b,c) +#define IDirect3DRMViewport_GetUniformScaling(p) (p)->GetUniformScaling() +#define IDirect3DRMViewport_GetX(p) (p)->GetX() +#define IDirect3DRMViewport_GetY(p) (p)->GetY() +#define IDirect3DRMViewport_GetWidth(p) (p)->GetWidth() +#define IDirect3DRMViewport_GetHeight(p) (p)->GetHeight() +#define IDirect3DRMViewport_GetField(p) (p)->GetField() +#define IDirect3DRMViewport_GetBack(p) (p)->GetBack() +#define IDirect3DRMViewport_GetFront(p) (p)->GetFront() +#define IDirect3DRMViewport_GetProjection(p) (p)->GetProjection() +#define IDirect3DRMViewport_GetDirect3DViewport(p,a) (p)->GetDirect3DViewport(a) +#endif + +/***************************************************************************** + * IDirect3DRMViewport2 interface + */ +#define INTERFACE IDirect3DRMViewport2 +DECLARE_INTERFACE_(IDirect3DRMViewport2,IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMViewport2 methods ***/ + STDMETHOD(Init) (THIS_ IDirect3DRMDevice3 *device, struct IDirect3DRMFrame3 *camera, + DWORD x, DWORD y, DWORD width, DWORD height) PURE; + STDMETHOD(Clear)(THIS_ DWORD flags) PURE; + STDMETHOD(Render)(THIS_ struct IDirect3DRMFrame3 *frame) PURE; + STDMETHOD(SetFront)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetBack)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetField)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetUniformScaling)(THIS_ BOOL) PURE; + STDMETHOD(SetCamera)(THIS_ struct IDirect3DRMFrame3 *camera) PURE; + STDMETHOD(SetProjection)(THIS_ D3DRMPROJECTIONTYPE) PURE; + STDMETHOD(Transform)(THIS_ D3DRMVECTOR4D *d, D3DVECTOR *s) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DRMVECTOR4D *s) PURE; + STDMETHOD(Configure)(THIS_ LONG x, LONG y, DWORD width, DWORD height) PURE; + STDMETHOD(ForceUpdate)(THIS_ DWORD x1, DWORD y1, DWORD x2, DWORD y2) PURE; + STDMETHOD(SetPlane)(THIS_ D3DVALUE left, D3DVALUE right, D3DVALUE bottom, D3DVALUE top) PURE; + STDMETHOD(GetCamera)(THIS_ struct IDirect3DRMFrame3 **camera) PURE; + STDMETHOD(GetDevice)(THIS_ IDirect3DRMDevice3 **device) PURE; + STDMETHOD(GetPlane)(THIS_ D3DVALUE *left, D3DVALUE *right, D3DVALUE *bottom, D3DVALUE *top) PURE; + STDMETHOD(Pick)(THIS_ LONG x, LONG y, struct IDirect3DRMPickedArray **visuals) PURE; + STDMETHOD_(BOOL, GetUniformScaling)(THIS) PURE; + STDMETHOD_(LONG, GetX)(THIS) PURE; + STDMETHOD_(LONG, GetY)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetField)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetBack)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetFront)(THIS) PURE; + STDMETHOD_(D3DRMPROJECTIONTYPE, GetProjection)(THIS) PURE; + STDMETHOD(GetDirect3DViewport)(THIS_ IDirect3DViewport **viewport) PURE; + STDMETHOD(TransformVectors)(THIS_ DWORD vector_count, D3DRMVECTOR4D *dst_vectors, + D3DVECTOR *src_vectors) PURE; + STDMETHOD(InverseTransformVectors)(THIS_ DWORD vector_count, D3DVECTOR *dst_vectors, + D3DRMVECTOR4D *src_vectors) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMViewport2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMViewport2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMViewport2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMViewport_2Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMViewport2_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMViewport2_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMViewport2_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMViewport2_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMViewport2_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMViewport2_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMViewport2_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMViewport2 methods ***/ +#define IDirect3DRMViewport2_Init(p,a,b,c,d,e,f) (p)->lpVtbl->Init(p,a,b,c,d,e,f) +#define IDirect3DRMViewport2_Clear(p,a) (p)->lpVtbl->Clear(p,a) +#define IDirect3DRMViewport2_Render(p,a) (p)->lpVtbl->Render(p,a) +#define IDirect3DRMViewport2_SetFront(p,a) (p)->lpVtbl->SetFront(p,a) +#define IDirect3DRMViewport2_SetBack(p,a) (p)->lpVtbl->SetBack(p,a) +#define IDirect3DRMViewport2_SetField(p,a) (p)->lpVtbl->SetField(p,a) +#define IDirect3DRMViewport2_SetUniformScaling(p,a) (p)->lpVtbl->SetUniformScaling(p,a) +#define IDirect3DRMViewport2_SetCamera(p,a) (p)->lpVtbl->SetCamera(p,a) +#define IDirect3DRMViewport2_SetProjection(p,a) (p)->lpVtbl->SetProjection(p,a) +#define IDirect3DRMViewport2_Transform(p,a,b) (p)->lpVtbl->Transform(p,a,b) +#define IDirect3DRMViewport2_InverseTransform(p,a,b) (p)->lpVtbl->InverseTransform(p,a,b) +#define IDirect3DRMViewport2_Configure(p,a,b,c,d) (p)->lpVtbl->Configure(p,a,b,c,d) +#define IDirect3DRMViewport2_ForceUpdate(p,a,b,c,d) (p)->lpVtbl->ForceUpdate(p,a,b,c,d) +#define IDirect3DRMViewport2_SetPlane(p,a,b,c,d) (p)->lpVtbl->SetPlane(p,a,b,c,d) +#define IDirect3DRMViewport2_GetCamera(p,a) (p)->lpVtbl->GetCamera(p,a) +#define IDirect3DRMViewport2_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DRMViewport2_GetPlane(p,a,b,c,d) (p)->lpVtbl->GetPlane(p,a,b,c,d) +#define IDirect3DRMViewport2_Pick(p,a,b,c) (p)->lpVtbl->Pick(p,a,b,c) +#define IDirect3DRMViewport2_GetUniformScaling(p) (p)->lpVtbl->GetUniformScaling(p) +#define IDirect3DRMViewport2_GetX(p) (p)->lpVtbl->GetX(p) +#define IDirect3DRMViewport2_GetY(p) (p)->lpVtbl->GetY(p) +#define IDirect3DRMViewport2_GetWidth(p) (p)->lpVtbl->GetWidth(p) +#define IDirect3DRMViewport2_GetHeight(p) (p)->lpVtbl->GetHeight(p) +#define IDirect3DRMViewport2_GetField(p) (p)->lpVtbl->GetField(p) +#define IDirect3DRMViewport2_GetBack(p) (p)->lpVtbl->GetBack(p) +#define IDirect3DRMViewport2_GetFront(p) (p)->lpVtbl->GetFront(p) +#define IDirect3DRMViewport2_GetProjection(p) (p)->lpVtbl->GetProjection(p) +#define IDirect3DRMViewport2_GetDirect3DViewport(p,a) (p)->lpVtbl->GetDirect3DViewport(p,a) +#define IDirect3DRMViewport2_TransformVectors(p,a,b,c) (p)->lpVtbl->TransformVectors(p,a,b,c) +#define IDirect3DRMViewport2_InverseTransformVectors(p,a,b,c) (p)->lpVtbl->InverseTransformVectors(p,a,b,c) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMViewport2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMViewport2_AddRef(p) (p)->AddRef() +#define IDirect3DRMViewport2_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMViewport2_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMViewport2_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMViewport2_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMViewport2_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMViewport2_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMViewport2_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMViewport2_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMViewport2_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMViewport2 methods ***/ +#define IDirect3DRMViewport2_Init(p,a,b,c,d,e,f) (p)->Init(a,b,c,d,e,f) +#define IDirect3DRMViewport2_Clear(p) (p)->Clear() +#define IDirect3DRMViewport2_Render(p,a) (p)->Render(a) +#define IDirect3DRMViewport2_SetFront(p,a) (p)->SetFront(a) +#define IDirect3DRMViewport2_SetBack(p,a) (p)->SetBack(a) +#define IDirect3DRMViewport2_SetField(p,a) (p)->SetField(a) +#define IDirect3DRMViewport2_SetUniformScaling(p,a) (p)->SetUniformScaling(a) +#define IDirect3DRMViewport2_SetCamera(p,a) (p)->SetCamera(a) +#define IDirect3DRMViewport2_SetProjection(p,a) (p)->SetProjection(a) +#define IDirect3DRMViewport2_Transform(p,a,b) (p)->Transform(a,b) +#define IDirect3DRMViewport2_InverseTransform(p,a,b) (p)->InverseTransform(a,b) +#define IDirect3DRMViewport2_Configure(p,a,b,c,d) (p)->Configure(a,b,c,d) +#define IDirect3DRMViewport2_ForceUpdate(p,a,b,c,d) (p)->ForceUpdate(a,b,c,d) +#define IDirect3DRMViewport2_SetPlane(p,a,b,c,d) (p)->SetPlane(a,b,c,d) +#define IDirect3DRMViewport2_GetCamera(p,a) (p)->GetCamera(a) +#define IDirect3DRMViewport2_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DRMViewport2_GetPlane(p,a,b,c,d) (p)->GetPlane(a,b,c,d) +#define IDirect3DRMViewport2_Pick(p,a,b,c) (p)->Pick(a,b,c) +#define IDirect3DRMViewport2_GetUniformScaling(p) (p)->GetUniformScaling() +#define IDirect3DRMViewport2_GetX(p) (p)->GetX() +#define IDirect3DRMViewport2_GetY(p) (p)->GetY() +#define IDirect3DRMViewport2_GetWidth(p) (p)->GetWidth() +#define IDirect3DRMViewport2_GetHeight(p) (p)->GetHeight() +#define IDirect3DRMViewport2_GetField(p) (p)->GetField() +#define IDirect3DRMViewport2_GetBack(p) (p)->GetBack() +#define IDirect3DRMViewport2_GetFront(p) (p)->GetFront() +#define IDirect3DRMViewport2_GetProjection(p) (p)->GetProjection() +#define IDirect3DRMViewport2_GetDirect3DViewport(p,a) (p)->GetDirect3DViewport(a) +#define IDirect3DRMViewport2_TransformVectors(p,a,b,c) (p)->TransformVectors(a,b,c) +#define IDirect3DRMViewport2_InverseTransformVectors(p,a,b,c) (p)->InverseTransformVectors(a,b,c) +#endif + +/***************************************************************************** + * IDirect3DRMFrame interface + */ +#define INTERFACE IDirect3DRMFrame +DECLARE_INTERFACE_(IDirect3DRMFrame,IDirect3DRMVisual) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMFrame methods ***/ + STDMETHOD(AddChild)(THIS_ IDirect3DRMFrame *child) PURE; + STDMETHOD(AddLight)(THIS_ struct IDirect3DRMLight *light) PURE; + STDMETHOD(AddMoveCallback)(THIS_ D3DRMFRAMEMOVECALLBACK cb, void *ctx) PURE; + STDMETHOD(AddTransform)(THIS_ D3DRMCOMBINETYPE, D3DRMMATRIX4D) PURE; + STDMETHOD(AddTranslation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScale)(THIS_ D3DRMCOMBINETYPE, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(AddRotation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(AddVisual)(THIS_ IDirect3DRMVisual *visual) PURE; + STDMETHOD(GetChildren)(THIS_ struct IDirect3DRMFrameArray **children) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; + STDMETHOD(GetLights)(THIS_ struct IDirect3DRMLightArray **lights) PURE; + STDMETHOD_(D3DRMMATERIALMODE, GetMaterialMode)(THIS) PURE; + STDMETHOD(GetParent)(THIS_ IDirect3DRMFrame **parent) PURE; + STDMETHOD(GetPosition)(THIS_ IDirect3DRMFrame *reference, D3DVECTOR *return_position) PURE; + STDMETHOD(GetRotation)(THIS_ IDirect3DRMFrame *reference, D3DVECTOR *axis, D3DVALUE *return_theta) PURE; + STDMETHOD(GetScene)(THIS_ IDirect3DRMFrame **scene) PURE; + STDMETHOD_(D3DRMSORTMODE, GetSortMode)(THIS) PURE; + STDMETHOD(GetTexture)(THIS_ struct IDirect3DRMTexture **texture) PURE; + STDMETHOD(GetTransform)(THIS_ D3DRMMATRIX4D return_matrix) PURE; + STDMETHOD(GetVelocity)(THIS_ IDirect3DRMFrame *reference, D3DVECTOR *return_velocity, BOOL with_rotation) PURE; + STDMETHOD(GetOrientation)(THIS_ IDirect3DRMFrame *reference, D3DVECTOR *dir, D3DVECTOR *up) PURE; + STDMETHOD(GetVisuals)(THIS_ struct IDirect3DRMVisualArray **visuals) PURE; + STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + STDMETHOD(Load)(THIS_ void *filename, void *name, D3DRMLOADOPTIONS flags, + D3DRMLOADTEXTURECALLBACK cb, void *ctx)PURE; + STDMETHOD(LookAt)(THIS_ IDirect3DRMFrame *target, IDirect3DRMFrame *reference, + D3DRMFRAMECONSTRAINT constraint) PURE; + STDMETHOD(Move)(THIS_ D3DVALUE delta) PURE; + STDMETHOD(DeleteChild)(THIS_ IDirect3DRMFrame *child) PURE; + STDMETHOD(DeleteLight)(THIS_ struct IDirect3DRMLight *light) PURE; + STDMETHOD(DeleteMoveCallback)(THIS_ D3DRMFRAMEMOVECALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteVisual)(THIS_ IDirect3DRMVisual *visual) PURE; + STDMETHOD_(D3DCOLOR, GetSceneBackground)(THIS) PURE; + STDMETHOD(GetSceneBackgroundDepth)(THIS_ IDirectDrawSurface **surface) PURE; + STDMETHOD_(D3DCOLOR, GetSceneFogColor)(THIS) PURE; + STDMETHOD_(BOOL, GetSceneFogEnable)(THIS) PURE; + STDMETHOD_(D3DRMFOGMODE, GetSceneFogMode)(THIS) PURE; + STDMETHOD(GetSceneFogParams)(THIS_ D3DVALUE *return_start, D3DVALUE *return_end, D3DVALUE *return_density) PURE; + STDMETHOD(SetSceneBackground)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneBackgroundRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetSceneBackgroundDepth)(THIS_ IDirectDrawSurface *surface) PURE; + STDMETHOD(SetSceneBackgroundImage)(THIS_ struct IDirect3DRMTexture *texture) PURE; + STDMETHOD(SetSceneFogEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetSceneFogColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneFogMode)(THIS_ D3DRMFOGMODE) PURE; + STDMETHOD(SetSceneFogParams)(THIS_ D3DVALUE start, D3DVALUE end, D3DVALUE density) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD_(D3DRMZBUFFERMODE, GetZbufferMode)(THIS) PURE; + STDMETHOD(SetMaterialMode)(THIS_ D3DRMMATERIALMODE) PURE; + STDMETHOD(SetOrientation)(THIS_ IDirect3DRMFrame *reference, D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz) PURE; + STDMETHOD(SetPosition)(THIS_ IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetRotation)(THIS_ IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(SetSortMode)(THIS_ D3DRMSORTMODE) PURE; + STDMETHOD(SetTexture)(THIS_ struct IDirect3DRMTexture *texture) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetVelocity)(THIS_ IDirect3DRMFrame *reference, + D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation) PURE; + STDMETHOD(SetZbufferMode)(THIS_ D3DRMZBUFFERMODE) PURE; + STDMETHOD(Transform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMFrame_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMFrame_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMFrame_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMFrame_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMFrame_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMFrame_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMFrame_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMFrame_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMFrame_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMFrame_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMFrame_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMFrame methods ***/ +#define IDirect3DRMFrame_AddChild(p,a) (p)->lpVtbl->AddChild(p,a) +#define IDirect3DRMFrame_AddLight(p,a) (p)->lpVtbl->AddLight(p,a) +#define IDirect3DRMFrame_AddMoveCallback(p,a,b) (p)->lpVtbl->AddMoveCallback(p,a,b) +#define IDirect3DRMFrame_AddTransform(p,a,b) (p)->lpVtbl->AddTransform(p,a,b) +#define IDirect3DRMFrame_AddTranslation(p,a,b,c,d) (p)->lpVtbl->AddTranslation(p,a,b,c,d) +#define IDirect3DRMFrame_AddScale(p,a,b,c,d) (p)->lpVtbl->AddScale(p,a,b,c,d) +#define IDirect3DRMFrame_AddRotation(p,a,b,c,d,e) (p)->lpVtbl->AddRotation(p,a,b,c,d,e) +#define IDirect3DRMFrame_AddVisual(p,a) (p)->lpVtbl->AddVisual(p,a) +#define IDirect3DRMFrame_GetChildren(p,a) (p)->lpVtbl->GetChildren(p,a) +#define IDirect3DRMFrame_GetColor(p) (p)->lpVtbl->GetColor(p) +#define IDirect3DRMFrame_GetLights(p,a) (p)->lpVtbl->GetLights(p,a) +#define IDirect3DRMFrame_GetMaterialMode(p) (p)->lpVtbl->GetMaterialMode(p) +#define IDirect3DRMFrame_GetParent(p,a) (p)->lpVtbl->GetParent(p,a) +#define IDirect3DRMFrame_GetPosition(p,a,b) (p)->lpVtbl->GetPosition(p,a,b) +#define IDirect3DRMFrame_GetRotation(p,a,b,c) (p)->lpVtbl->GetRotation(p,a,b,c) +#define IDirect3DRMFrame_GetScene(p,a) (p)->lpVtbl->GetScene(p,a) +#define IDirect3DRMFrame_GetSortMode(p) (p)->lpVtbl->GetSortMode(p) +#define IDirect3DRMFrame_GetTexture(p,a) (p)->lpVtbl->GetTexture(p,a) +#define IDirect3DRMFrame_GetTransform(p,a) (p)->lpVtbl->GetTransform(p,a) +#define IDirect3DRMFrame_GetVelocity(p,a,b,c) (p)->lpVtbl->GetVelocity(p,a,b,c) +#define IDirect3DRMFrame_GetOrientation(p,a,b,c) (p)->lpVtbl->GetOrientation(p,a,b,c) +#define IDirect3DRMFrame_GetVisuals(p,a) (p)->lpVtbl->GetVisuals(p,a) +#define IDirect3DRMFrame_GetTextureTopology(p,a,b) (p)->lpVtbl->GetTextureTopology(p,a,b) +#define IDirect3DRMFrame_InverseTransform(p,a,b) (p)->lpVtbl->InverseTransform(p,a,b) +#define IDirect3DRMFrame_Load(p,a,b,c,d,e) (p)->lpVtbl->Load(p,a,b,c,d,e) +#define IDirect3DRMFrame_LookAt(p,a,b,c) (p)->lpVtbl->LookAt(p,a,b,c) +#define IDirect3DRMFrame_Move(p,a) (p)->lpVtbl->Move(p,a) +#define IDirect3DRMFrame_DeleteChild(p,a) (p)->lpVtbl->DeleteChild(p,a) +#define IDirect3DRMFrame_DeleteLight(p,a) (p)->lpVtbl->DeleteLight(p,a) +#define IDirect3DRMFrame_DeleteMoveCallback(p,a,b) (p)->lpVtbl->DeleteMoveCallback(p,a,b) +#define IDirect3DRMFrame_DeleteVisual(p,a) (p)->lpVtbl->DeleteVisual(p,a) +#define IDirect3DRMFrame_GetSceneBackground(p) (p)->lpVtbl->GetSceneBackground(p) +#define IDirect3DRMFrame_GetSceneBackgroundDepth(p,a) (p)->lpVtbl->GetSceneBackgroundDepth(p,a) +#define IDirect3DRMFrame_GetSceneFogColor(p) (p)->lpVtbl->GetSceneFogColor(p) +#define IDirect3DRMFrame_GetSceneFogEnable(p) (p)->lpVtbl->GetSceneFogEnable(p) +#define IDirect3DRMFrame_GetSceneFogMode(p) (p)->lpVtbl->GetSceneFogMode(p) +#define IDirect3DRMFrame_GetSceneFogParams(p,a,b,c) (p)->lpVtbl->GetSceneFogParams(p,a,b,c) +#define IDirect3DRMFrame_SetSceneBackground(p,a) (p)->lpVtbl->SetSceneBackground(p,a) +#define IDirect3DRMFrame_SetSceneBackgroundRGB(p,a,b,c) (p)->lpVtbl->SetSceneBackgroundRGB(p,a,b,c) +#define IDirect3DRMFrame_SetSceneBackgroundDepth(p,a) (p)->lpVtbl->SetSceneBackgroundDepth(p,a) +#define IDirect3DRMFrame_SetSceneBackgroundImage(p,a) (p)->lpVtbl->SetSceneBackgroundImage(p,a) +#define IDirect3DRMFrame_SetSceneFogEnable(p,a) (p)->lpVtbl->SetSceneFogEnable(p,a) +#define IDirect3DRMFrame_SetSceneFogColor(p,a) (p)->lpVtbl->SetSceneFogColor(p,a) +#define IDirect3DRMFrame_SetSceneFogMode(p,a) (p)->lpVtbl->SetSceneFogMode(p,a) +#define IDirect3DRMFrame_SetSceneFogParams(p,a,b,c) (p)->lpVtbl->SetSceneFogParams(p,a,b,c) +#define IDirect3DRMFrame_SetColor(p,a) (p)->lpVtbl->SetColor(p,a) +#define IDirect3DRMFrame_SetColorRGB(p,a,b,c) (p)->lpVtbl->SetColorRGB(p,a,b,c) +#define IDirect3DRMFrame_GetZbufferMode(p) (p)->lpVtbl->GetZbufferMode(p) +#define IDirect3DRMFrame_SetMaterialMode(p,a) (p)->lpVtbl->SetMaterialMode(p,a) +#define IDirect3DRMFrame_SetOrientation(p,a,b,c,d,e,f,g) (p)->lpVtbl->SetOrientation(p,a,b,c,d,e,f,g) +#define IDirect3DRMFrame_SetPosition(p,a,b,c,d) (p)->lpVtbl->SetPosition(p,a,b,c,d) +#define IDirect3DRMFrame_SetRotation(p,a,b,c,d,e) (p)->lpVtbl->SetRotation(p,a,b,c,d,e) +#define IDirect3DRMFrame_SetSortMode(p,a) (p)->lpVtbl->SetSortMode(p,a) +#define IDirect3DRMFrame_SetTexture(p,a) (p)->lpVtbl->SetTexture(p,a) +#define IDirect3DRMFrame_SetTextureTopology(p,a,b) (p)->lpVtbl->SetTextureTopology(p,a,b) +#define IDirect3DRMFrame_SetVelocity(p,a,b,c,d,e) (p)->lpVtbl->SetVelocity(p,a,b,c,d,e) +#define IDirect3DRMFrame_SetZbufferMode(p,a) (p)->lpVtbl->SetZbufferMode(p,a) +#define IDirect3DRMFrame_Transform(p,a,b) (p)->lpVtbl->Transform(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMFrame_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMFrame_AddRef(p) (p)->AddRef() +#define IDirect3DRMFrame_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMFrame_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMFrame_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMFrame_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMFrame_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMFrame_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMFrame_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMFrame_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMFrame_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMFrame methods ***/ +#define IDirect3DRMFrame_AddChild(p,a) (p)->AddChild(a) +#define IDirect3DRMFrame_AddLight(p,a) (p)->AddLight(a) +#define IDirect3DRMFrame_AddMoveCallback(p,a,b) (p)->AddMoveCallback(a,b) +#define IDirect3DRMFrame_AddTransform(p,a,b) (p)->AddTransform(a,b) +#define IDirect3DRMFrame_AddTranslation(p,a,b,c,d) (p)->AddTranslation(a,b,c,d) +#define IDirect3DRMFrame_AddScale(p,a,b,c,d) (p)->AddScale(a,b,c,d) +#define IDirect3DRMFrame_AddRotation(p,a,b,c,d,e) (p)->AddRotation(a,b,c,d,e) +#define IDirect3DRMFrame_AddVisual(p,a) (p)->AddVisual(a) +#define IDirect3DRMFrame_GetChildren(p,a) (p)->GetChildren(a) +#define IDirect3DRMFrame_GetColor(p) (p)->GetColor() +#define IDirect3DRMFrame_GetLights(p,a) (p)->GetLights(a) +#define IDirect3DRMFrame_GetMaterialMode(p) (p)->GetMaterialMode() +#define IDirect3DRMFrame_GetParent(p,a) (p)->GetParent(a) +#define IDirect3DRMFrame_GetPosition(p,a,b) (p)->GetPosition(a,b) +#define IDirect3DRMFrame_GetRotation(p,a,b,c) (p)->GetRotation(a,b,c) +#define IDirect3DRMFrame_GetScene(p,a) (p)->GetScene(a) +#define IDirect3DRMFrame_GetSortMode(p) (p)->GetSortMode() +#define IDirect3DRMFrame_GetTexture(p,a) (p)->GetTexture(a) +#define IDirect3DRMFrame_GetTransform(p,a) (p)->GetTransform(a) +#define IDirect3DRMFrame_GetVelocity(p,a,b,c) (p)->GetVelocity(a,b,c) +#define IDirect3DRMFrame_GetOrientation(p,a,b,c) (p)->GetOrientation(a,b,c) +#define IDirect3DRMFrame_GetVisuals(p,a) (p)->GetVisuals(a) +#define IDirect3DRMFrame_GetTextureTopology(p,a,b) (p)->GetTextureTopology(a,b) +#define IDirect3DRMFrame_InverseTransform(p,a,b) (p)->InverseTransform(a,b) +#define IDirect3DRMFrame_Load(p,a,b,c,d,e) (p)->Load(a,b,c,d,e) +#define IDirect3DRMFrame_LookAt(p,a,b,c) (p)->LookAt(a,b,c) +#define IDirect3DRMFrame_Move(p,a) (p)->Move(a) +#define IDirect3DRMFrame_DeleteChild(p,a) (p)->DeleteChild(a) +#define IDirect3DRMFrame_DeleteLight(p,a) (p)->DeleteLight(a) +#define IDirect3DRMFrame_DeleteMoveCallback(p,a,b) (p)->DeleteMoveCallback(a,b) +#define IDirect3DRMFrame_DeleteVisual(p,a) (p)->DeleteVisual(a) +#define IDirect3DRMFrame_GetSceneBackground(p) (p)->GetSceneBackground() +#define IDirect3DRMFrame_GetSceneBackgroundDepth(p,a) (p)->GetSceneBackgroundDepth(a) +#define IDirect3DRMFrame_GetSceneFogColor(p) (p)->GetSceneFogColor() +#define IDirect3DRMFrame_GetSceneFogEnable(p) (p)->GetSceneFogEnable() +#define IDirect3DRMFrame_GetSceneFogMode(p) (p)->GetSceneFogMode() +#define IDirect3DRMFrame_GetSceneFogParams(p,a,b,c) (p)->GetSceneFogParams(a,b,c) +#define IDirect3DRMFrame_SetSceneBackground(p,a) (p)->SetSceneBackground(a) +#define IDirect3DRMFrame_SetSceneBackgroundRGB(p,a,b,c) (p)->SetSceneBackgroundRGB(a,b,c) +#define IDirect3DRMFrame_SetSceneBackgroundDepth(p,a) (p)->SetSceneBackgroundDepth(a) +#define IDirect3DRMFrame_SetSceneBackgroundImage(p,a) (p)->SetSceneBackgroundImage(a) +#define IDirect3DRMFrame_SetSceneFogEnable(p,a) (p)->SetSceneFogEnable(a) +#define IDirect3DRMFrame_SetSceneFogColor(p,a) (p)->SetSceneFogColor(a) +#define IDirect3DRMFrame_SetSceneFogMode(p,a) (p)->SetSceneFogMode(a) +#define IDirect3DRMFrame_SetSceneFogParams(p,a,b,c) (p)->SetSceneFogParams(a,b,c) +#define IDirect3DRMFrame_SetColor(p,a) (p)->SetColor(a) +#define IDirect3DRMFrame_SetColorRGB(p,a,b,c) (p)->SetColorRGB(a,b,c) +#define IDirect3DRMFrame_GetZbufferMode(p) (p)->GetZbufferMode() +#define IDirect3DRMFrame_SetMaterialMode(p,a) (p)->SetMaterialMode(a) +#define IDirect3DRMFrame_SetOrientation(p,a,b,c,d,e,f,g) (p)->SetOrientation(a,b,c,d,e,f,g) +#define IDirect3DRMFrame_SetPosition(p,a,b,c,d) (p)->SetPosition(a,b,c,d) +#define IDirect3DRMFrame_SetRotation(p,a,b,c,d,e) (p)->SetRotation(a,b,c,d,e) +#define IDirect3DRMFrame_SetSortMode(p,a) (p)->SetSortMode(a) +#define IDirect3DRMFrame_SetTexture(p,a) (p)->SetTexture(a) +#define IDirect3DRMFrame_SetTextureTopology(p,a,b) (p)->SetTextureTopology(a,b) +#define IDirect3DRMFrame_SetVelocity(p,a,b,c,d,e) (p)->SetVelocity(a,b,c,d,e) +#define IDirect3DRMFrame_SetZbufferMode(p,a) (p)->SetZbufferMode(a) +#define IDirect3DRMFrame_Transform(p,a,b) (p)->Transform(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMFrame2 interface + */ +#define INTERFACE IDirect3DRMFrame2 +DECLARE_INTERFACE_(IDirect3DRMFrame2,IDirect3DRMFrame) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMFrame methods ***/ + STDMETHOD(AddChild)(THIS_ IDirect3DRMFrame *child) PURE; + STDMETHOD(AddLight)(THIS_ struct IDirect3DRMLight *light) PURE; + STDMETHOD(AddMoveCallback)(THIS_ D3DRMFRAMEMOVECALLBACK cb, void *ctx) PURE; + STDMETHOD(AddTransform)(THIS_ D3DRMCOMBINETYPE, D3DRMMATRIX4D) PURE; + STDMETHOD(AddTranslation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScale)(THIS_ D3DRMCOMBINETYPE, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(AddRotation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(AddVisual)(THIS_ IDirect3DRMVisual *visual) PURE; + STDMETHOD(GetChildren)(THIS_ struct IDirect3DRMFrameArray **children) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; + STDMETHOD(GetLights)(THIS_ struct IDirect3DRMLightArray **lights) PURE; + STDMETHOD_(D3DRMMATERIALMODE, GetMaterialMode)(THIS) PURE; + STDMETHOD(GetParent)(THIS_ IDirect3DRMFrame **parent) PURE; + STDMETHOD(GetPosition)(THIS_ IDirect3DRMFrame *reference, D3DVECTOR *return_position) PURE; + STDMETHOD(GetRotation)(THIS_ IDirect3DRMFrame *reference, D3DVECTOR *axis, D3DVALUE *return_theta) PURE; + STDMETHOD(GetScene)(THIS_ IDirect3DRMFrame **scene) PURE; + STDMETHOD_(D3DRMSORTMODE, GetSortMode)(THIS) PURE; + STDMETHOD(GetTexture)(THIS_ struct IDirect3DRMTexture **texture) PURE; + STDMETHOD(GetTransform)(THIS_ D3DRMMATRIX4D return_matrix) PURE; + STDMETHOD(GetVelocity)(THIS_ IDirect3DRMFrame *reference, D3DVECTOR *return_velocity, BOOL with_rotation) PURE; + STDMETHOD(GetOrientation)(THIS_ IDirect3DRMFrame *reference, D3DVECTOR *dir, D3DVECTOR *up) PURE; + STDMETHOD(GetVisuals)(THIS_ struct IDirect3DRMVisualArray **visuals) PURE; + STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + STDMETHOD(Load)(THIS_ void *filename, void *name, D3DRMLOADOPTIONS flags, + D3DRMLOADTEXTURECALLBACK cb, void *ctx)PURE; + STDMETHOD(LookAt)(THIS_ IDirect3DRMFrame *target, IDirect3DRMFrame *reference, + D3DRMFRAMECONSTRAINT constraint) PURE; + STDMETHOD(Move)(THIS_ D3DVALUE delta) PURE; + STDMETHOD(DeleteChild)(THIS_ IDirect3DRMFrame *child) PURE; + STDMETHOD(DeleteLight)(THIS_ struct IDirect3DRMLight *light) PURE; + STDMETHOD(DeleteMoveCallback)(THIS_ D3DRMFRAMEMOVECALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteVisual)(THIS_ IDirect3DRMVisual *visual) PURE; + STDMETHOD_(D3DCOLOR, GetSceneBackground)(THIS) PURE; + STDMETHOD(GetSceneBackgroundDepth)(THIS_ IDirectDrawSurface **surface) PURE; + STDMETHOD_(D3DCOLOR, GetSceneFogColor)(THIS) PURE; + STDMETHOD_(BOOL, GetSceneFogEnable)(THIS) PURE; + STDMETHOD_(D3DRMFOGMODE, GetSceneFogMode)(THIS) PURE; + STDMETHOD(GetSceneFogParams)(THIS_ D3DVALUE *return_start, D3DVALUE *return_end, D3DVALUE *return_density) PURE; + STDMETHOD(SetSceneBackground)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneBackgroundRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetSceneBackgroundDepth)(THIS_ IDirectDrawSurface *surface) PURE; + STDMETHOD(SetSceneBackgroundImage)(THIS_ struct IDirect3DRMTexture *texture) PURE; + STDMETHOD(SetSceneFogEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetSceneFogColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneFogMode)(THIS_ D3DRMFOGMODE) PURE; + STDMETHOD(SetSceneFogParams)(THIS_ D3DVALUE start, D3DVALUE end, D3DVALUE density) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD_(D3DRMZBUFFERMODE, GetZbufferMode)(THIS) PURE; + STDMETHOD(SetMaterialMode)(THIS_ D3DRMMATERIALMODE) PURE; + STDMETHOD(SetOrientation)(THIS_ IDirect3DRMFrame *reference, D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz) PURE; + STDMETHOD(SetPosition)(THIS_ IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetRotation)(THIS_ IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(SetSortMode)(THIS_ D3DRMSORTMODE) PURE; + STDMETHOD(SetTexture)(THIS_ struct IDirect3DRMTexture *texture) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetVelocity)(THIS_ IDirect3DRMFrame *reference, + D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation) PURE; + STDMETHOD(SetZbufferMode)(THIS_ D3DRMZBUFFERMODE) PURE; + STDMETHOD(Transform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + /*** IDirect3DRMFrame2 methods ***/ + STDMETHOD(AddMoveCallback2)(THIS_ D3DRMFRAMEMOVECALLBACK cb, void *ctx, DWORD flags) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *box) PURE; + STDMETHOD_(BOOL, GetBoxEnable)(THIS) PURE; + STDMETHOD(GetAxes)(THIS_ D3DVECTOR *dir, D3DVECTOR *up); + STDMETHOD(GetMaterial)(THIS_ struct IDirect3DRMMaterial **material) PURE; + STDMETHOD_(BOOL, GetInheritAxes)(THIS); + STDMETHOD(GetHierarchyBox)(THIS_ D3DRMBOX *box) PURE; + STDMETHOD(SetBox)(THIS_ D3DRMBOX *box) PURE; + STDMETHOD(SetBoxEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetAxes)(THIS_ D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz); + STDMETHOD(SetInheritAxes)(THIS_ BOOL inherit_from_parent); + STDMETHOD(SetMaterial)(THIS_ struct IDirect3DRMMaterial *material) PURE; + STDMETHOD(SetQuaternion)(THIS_ IDirect3DRMFrame *reference, D3DRMQUATERNION *q) PURE; + STDMETHOD(RayPick)(THIS_ IDirect3DRMFrame *reference, D3DRMRAY *ray, DWORD flags, + struct IDirect3DRMPicked2Array **return_visuals) PURE; + STDMETHOD(Save)(THIS_ const char *filename, D3DRMXOFFORMAT format, D3DRMSAVEOPTIONS flags); +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMFrame2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMFrame2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMFrame2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMFrame2_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMFrame2_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMFrame2_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMFrame2_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMFrame2_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMFrame2_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMFrame2_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMFrame2_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMFrame methods ***/ +#define IDirect3DRMFrame2_AddChild(p,a) (p)->lpVtbl->AddChild(p,a) +#define IDirect3DRMFrame2_AddLight(p,a) (p)->lpVtbl->AddLight(p,a) +#define IDirect3DRMFrame2_AddMoveCallback(p,a,b) (p)->lpVtbl->AddMoveCallback(p,a,b) +#define IDirect3DRMFrame2_AddTransform(p,a,b) (p)->lpVtbl->AddTransform(p,a,b) +#define IDirect3DRMFrame2_AddTranslation(p,a,b,c,d) (p)->lpVtbl->AddTranslation(p,a,b,c,d) +#define IDirect3DRMFrame2_AddScale(p,a,b,c,d) (p)->lpVtbl->AddScale(p,a,b,c,d) +#define IDirect3DRMFrame2_AddRotation(p,a,b,c,d,e) (p)->lpVtbl->AddRotation(p,a,b,c,d,e) +#define IDirect3DRMFrame2_AddVisual(p,a) (p)->lpVtbl->AddVisual(p,a) +#define IDirect3DRMFrame2_GetChildren(p,a) (p)->lpVtbl->GetChildren(p,a) +#define IDirect3DRMFrame2_GetColor(p) (p)->lpVtbl->GetColor(p) +#define IDirect3DRMFrame2_GetLights(p,a) (p)->lpVtbl->GetLights(p,a) +#define IDirect3DRMFrame2_GetMaterialMode(p) (p)->lpVtbl->GetMaterialMode(p) +#define IDirect3DRMFrame2_GetParent(p,a) (p)->lpVtbl->GetParent(p,a) +#define IDirect3DRMFrame2_GetPosition(p,a,b) (p)->lpVtbl->GetPosition(p,a,b) +#define IDirect3DRMFrame2_GetRotation(p,a,b,c) (p)->lpVtbl->GetRotation(p,a,b,c) +#define IDirect3DRMFrame2_GetScene(p,a) (p)->lpVtbl->GetScene(p,a) +#define IDirect3DRMFrame2_GetSortMode(p) (p)->lpVtbl->GetSortMode(p) +#define IDirect3DRMFrame2_GetTexture(p,a) (p)->lpVtbl->GetTexture(p,a) +#define IDirect3DRMFrame2_GetTransform(p,a) (p)->lpVtbl->GetTransform(p,a) +#define IDirect3DRMFrame2_GetVelocity(p,a,b,c) (p)->lpVtbl->GetVelocity(p,a,b,c) +#define IDirect3DRMFrame2_GetOrientation(p,a,b,c) (p)->lpVtbl->GetOrientation(p,a,b,c) +#define IDirect3DRMFrame2_GetVisuals(p,a) (p)->lpVtbl->GetVisuals(p,a) +#define IDirect3DRMFrame2_GetTextureTopology(p,a,b) (p)->lpVtbl->GetTextureTopology(p,a,b) +#define IDirect3DRMFrame2_InverseTransform(p,a,b) (p)->lpVtbl->InverseTransform(p,a,b) +#define IDirect3DRMFrame2_Load(p,a,b,c,d,e) (p)->lpVtbl->Load(p,a,b,c,d,e) +#define IDirect3DRMFrame2_LookAt(p,a,b,c) (p)->lpVtbl->LookAt(p,a,b,c) +#define IDirect3DRMFrame2_Move(p,a) (p)->lpVtbl->Move(p,a) +#define IDirect3DRMFrame2_DeleteChild(p,a) (p)->lpVtbl->DeleteChild(p,a) +#define IDirect3DRMFrame2_DeleteLight(p,a) (p)->lpVtbl->DeleteLight(p,a) +#define IDirect3DRMFrame2_DeleteMoveCallback(p,a,b) (p)->lpVtbl->DeleteMoveCallback(p,a,b) +#define IDirect3DRMFrame2_DeleteVisual(p,a) (p)->lpVtbl->DeleteVisual(p,a) +#define IDirect3DRMFrame2_GetSceneBackground(p) (p)->lpVtbl->GetSceneBackground(p) +#define IDirect3DRMFrame2_GetSceneBackgroundDepth(p,a) (p)->lpVtbl->GetSceneBackgroundDepth(p,a) +#define IDirect3DRMFrame2_GetSceneFogColor(p) (p)->lpVtbl->GetSceneFogColor(p) +#define IDirect3DRMFrame2_GetSceneFogEnable(p) (p)->lpVtbl->GetSceneFogEnable(p) +#define IDirect3DRMFrame2_GetSceneFogMode(p) (p)->lpVtbl->GetSceneFogMode(p) +#define IDirect3DRMFrame2_GetSceneFogParams(p,a,b,c) (p)->lpVtbl->GetSceneFogParams(p,a,b,c) +#define IDirect3DRMFrame2_SetSceneBackground(p,a) (p)->lpVtbl->SetSceneBackground(p,a) +#define IDirect3DRMFrame2_SetSceneBackgroundRGB(p,a,b,c) (p)->lpVtbl->SetSceneBackgroundRGB(p,a,b,c) +#define IDirect3DRMFrame2_SetSceneBackgroundDepth(p,a) (p)->lpVtbl->SetSceneBackgroundDepth(p,a) +#define IDirect3DRMFrame2_SetSceneBackgroundImage(p,a) (p)->lpVtbl->SetSceneBackgroundImage(p,a) +#define IDirect3DRMFrame2_SetSceneFogEnable(p,a) (p)->lpVtbl->SetSceneFogEnable(p,a) +#define IDirect3DRMFrame2_SetSceneFogColor(p,a) (p)->lpVtbl->SetSceneFogColor(p,a) +#define IDirect3DRMFrame2_SetSceneFogMode(p,a) (p)->lpVtbl->SetSceneFogMode(p,a) +#define IDirect3DRMFrame2_SetSceneFogParams(p,a,b,c) (p)->lpVtbl->SetSceneFogParams(p,a,b,c) +#define IDirect3DRMFrame2_SetColor(p,a) (p)->lpVtbl->SetColor(p,a) +#define IDirect3DRMFrame2_SetColorRGB(p,a,b,c) (p)->lpVtbl->SetColorRGB(p,a,b,c) +#define IDirect3DRMFrame2_GetZbufferMode(p) (p)->lpVtbl->GetZbufferMode(p) +#define IDirect3DRMFrame2_SetMaterialMode(p,a) (p)->lpVtbl->SetMaterialMode(p,a) +#define IDirect3DRMFrame2_SetOrientation(p,a,b,c,d,e,f,g) (p)->lpVtbl->SetOrientation(p,a,b,c,d,e,f,g) +#define IDirect3DRMFrame2_SetPosition(p,a,b,c,d) (p)->lpVtbl->SetPosition(p,a,b,c,d) +#define IDirect3DRMFrame2_SetRotation(p,a,b,c,d,e) (p)->lpVtbl->SetRotation(p,a,b,c,d,e) +#define IDirect3DRMFrame2_SetSortMode(p,a) (p)->lpVtbl->SetSortMode(p,a) +#define IDirect3DRMFrame2_SetTexture(p,a) (p)->lpVtbl->SetTexture(p,a) +#define IDirect3DRMFrame2_SetTextureTopology(p,a,b) (p)->lpVtbl->SetTextureTopology(p,a,b) +#define IDirect3DRMFrame2_SetVelocity(p,a,b,c,d,e) (p)->lpVtbl->SetVelocity(p,a,b,c,d,e) +#define IDirect3DRMFrame2_SetZbufferMode(p,a) (p)->lpVtbl->SetZbufferMode(p,a) +#define IDirect3DRMFrame2_Transform(p,a,b) (p)->lpVtbl->Transform(p,a,b) +/*** IDirect3DRMFrame2 methods ***/ +#define IDirect3DRMFrame2_AddMoveCallback2(p,a,b,c) (p)->lpVtbl->AddMoveCallback2(p,a,b,c) +#define IDirect3DRMFrame2_GetBox(p,a) (p)->lpVtbl->GetBox(p,a) +#define IDirect3DRMFrame2_GetBoxEnable(p) (p)->lpVtbl->GetBoxEnable(p) +#define IDirect3DRMFrame2_GetAxes(p,a,b) (p)->lpVtbl->GetAxes(p,a,b) +#define IDirect3DRMFrame2_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DRMFrame2_GetInheritAxes(p,a,b) (p)->lpVtbl->GetInheritAxes(p,a,b) +#define IDirect3DRMFrame2_GetHierarchyBox(p,a) (p)->lpVtbl->GetHierarchyBox(p,a) +#define IDirect3DRMFrame2_SetBox(p,a) (p)->lpVtbl->SetBox(p,a) +#define IDirect3DRMFrame2_SetBoxEnable(p,a) (p)->lpVtbl->SetBoxEnable(p,a) +#define IDirect3DRMFrame2_SetAxes(p,a,b,c,d,e,f) (p)->lpVtbl->SetAxes(p,a,b,c,d,e,f) +#define IDirect3DRMFrame2_SetInheritAxes(p,a) (p)->lpVtbl->SetInheritAxes(p,a) +#define IDirect3DRMFrame2_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DRMFrame2_SetQuaternion(p,a,b) (p)->lpVtbl->SetQuaternion(p,a,b) +#define IDirect3DRMFrame2_RayPick(p,a,b,c,d) (p)->lpVtbl->RayPick(p,a,b,c,d) +#define IDirect3DRMFrame2_Save(p,a,b,c) (p)->lpVtbl->Save(p,a,b,c) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMFrame2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMFrame2_AddRef(p) (p)->AddRef() +#define IDirect3DRMFrame2_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMFrame2_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMFrame2_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMFrame2_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMFrame2_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMFrame2_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMFrame2_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMFrame2_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMFrame2_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMFrame methods ***/ +#define IDirect3DRMFrame2_AddChild(p,a) (p)->AddChild(a) +#define IDirect3DRMFrame2_AddLight(p,a) (p)->AddLight(a) +#define IDirect3DRMFrame2_AddMoveCallback(p,a,b) (p)->AddMoveCallback(a,b) +#define IDirect3DRMFrame2_AddTransform(p,a,b) (p)->AddTransform(a,b) +#define IDirect3DRMFrame2_AddTranslation(p,a,b,c,d) (p)->AddTranslation(a,b,c,d) +#define IDirect3DRMFrame2_AddScale(p,a,b,c,d) (p)->AddScale(a,b,c,d) +#define IDirect3DRMFrame2_AddRotation(p,a,b,c,d,e) (p)->AddRotation(a,b,c,d,e) +#define IDirect3DRMFrame2_AddVisual(p,a) (p)->AddVisual(a) +#define IDirect3DRMFrame2_GetChildren(p,a) (p)->GetChildren(a) +#define IDirect3DRMFrame2_GetColor(p) (p)->GetColor() +#define IDirect3DRMFrame2_GetLights(p,a) (p)->GetLights(a) +#define IDirect3DRMFrame2_GetMaterialMode(p) (p)->GetMaterialMode() +#define IDirect3DRMFrame2_GetParent(p,a) (p)->GetParent(a) +#define IDirect3DRMFrame2_GetPosition(p,a,b) (p)->GetPosition(a,b) +#define IDirect3DRMFrame2_GetRotation(p,a,b,c) (p)->GetRotation(a,b,c) +#define IDirect3DRMFrame2_GetScene(p,a) (p)->GetScene(a) +#define IDirect3DRMFrame2_GetSortMode(p) (p)->GetSortMode() +#define IDirect3DRMFrame2_GetTexture(p,a) (p)->GetTexture(a) +#define IDirect3DRMFrame2_GetTransform(p,a) (p)->GetTransform(a) +#define IDirect3DRMFrame2_GetVelocity(p,a,b,c) (p)->GetVelocity(a,b,c) +#define IDirect3DRMFrame2_GetOrientation(p,a,b,c) (p)->GetOrientation(a,b,c) +#define IDirect3DRMFrame2_GetVisuals(p,a) (p)->GetVisuals(a) +#define IDirect3DRMFrame2_GetTextureTopology(p,a,b) (p)->GetTextureTopology(a,b) +#define IDirect3DRMFrame2_InverseTransform(p,a,b) (p)->InverseTransform(a,b) +#define IDirect3DRMFrame2_Load(p,a,b,c,d,e) (p)->Load(a,b,c,d,e) +#define IDirect3DRMFrame2_LookAt(p,a,b,c) (p)->LookAt(a,b,c) +#define IDirect3DRMFrame2_Move(p,a) (p)->Move(a) +#define IDirect3DRMFrame2_DeleteChild(p,a) (p)->DeleteChild(a) +#define IDirect3DRMFrame2_DeleteLight(p,a) (p)->DeleteLight(a) +#define IDirect3DRMFrame2_DeleteMoveCallback(p,a,b) (p)->DeleteMoveCallback(a,b) +#define IDirect3DRMFrame2_DeleteVisual(p,a) (p)->DeleteVisual(a) +#define IDirect3DRMFrame2_GetSceneBackground(p) (p)->GetSceneBackground() +#define IDirect3DRMFrame2_GetSceneBackgroundDepth(p,a) (p)->GetSceneBackgroundDepth(a) +#define IDirect3DRMFrame2_GetSceneFogColor(p) (p)->GetSceneFogColor() +#define IDirect3DRMFrame2_GetSceneFogEnable(p) (p)->GetSceneFogEnable() +#define IDirect3DRMFrame2_GetSceneFogMode(p) (p)->GetSceneFogMode() +#define IDirect3DRMFrame2_GetSceneFogParams(p,a,b,c) (p)->GetSceneFogParams(a,b,c) +#define IDirect3DRMFrame2_SetSceneBackground(p,a) (p)->SetSceneBackground(a) +#define IDirect3DRMFrame2_SetSceneBackgroundRGB(p,a,b,c) (p)->SetSceneBackgroundRGB(a,b,c) +#define IDirect3DRMFrame2_SetSceneBackgroundDepth(p,a) (p)->SetSceneBackgroundDepth(a) +#define IDirect3DRMFrame2_SetSceneBackgroundImage(p,a) (p)->SetSceneBackgroundImage(a) +#define IDirect3DRMFrame2_SetSceneFogEnable(p,a) (p)->SetSceneFogEnable(a) +#define IDirect3DRMFrame2_SetSceneFogColor(p,a) (p)->SetSceneFogColor(a) +#define IDirect3DRMFrame2_SetSceneFogMode(p,a) (p)->SetSceneFogMode(a) +#define IDirect3DRMFrame2_SetSceneFogParams(p,a,b,c) (p)->SetSceneFogParams(a,b,c) +#define IDirect3DRMFrame2_SetColor(p,a) (p)->SetColor(a) +#define IDirect3DRMFrame2_SetColorRGB(p,a,b,c) (p)->SetColorRGB(a,b,c) +#define IDirect3DRMFrame2_GetZbufferMode(p) (p)->GetZbufferMode() +#define IDirect3DRMFrame2_SetMaterialMode(p,a) (p)->SetMaterialMode(a) +#define IDirect3DRMFrame2_SetOrientation(p,a,b,c,d,e,f,g) (p)->SetOrientation(a,b,c,d,e,f,g) +#define IDirect3DRMFrame2_SetPosition(p,a,b,c,d) (p)->SetPosition(a,b,c,d) +#define IDirect3DRMFrame2_SetRotation(p,a,b,c,d,e) (p)->SetRotation(a,b,c,d,e) +#define IDirect3DRMFrame2_SetSortMode(p,a) (p)->SetSortMode(a) +#define IDirect3DRMFrame2_SetTexture(p,a) (p)->SetTexture(a) +#define IDirect3DRMFrame2_SetTextureTopology(p,a,b) (p)->SetTextureTopology(a,b) +#define IDirect3DRMFrame2_SetVelocity(p,a,b,c,d,e) (p)->SetVelocity(a,b,c,d,e) +#define IDirect3DRMFrame2_SetZbufferMode(p,a) (p)->SetZbufferMode(a) +#define IDirect3DRMFrame2_Transform(p,a,b) (p)->Transform(a,b) +/*** IDirect3DRMFrame2 methods ***/ +#define IDirect3DRMFrame2_AddMoveCallback2(p,a,b,c) (p)->AddMoveCallback2(a,b,c) +#define IDirect3DRMFrame2_GetBox(p,a) (p)->GetBox(a) +#define IDirect3DRMFrame2_GetBoxEnable(p) (p)->GetBoxEnable() +#define IDirect3DRMFrame2_GetAxes(p,a,b) (p)->GetAxes(a,b) +#define IDirect3DRMFrame2_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DRMFrame2_GetInheritAxes(p,a,b) (p)->GetInheritAxes(a,b) +#define IDirect3DRMFrame2_GetHierarchyBox(p,a) (p)->GetHierarchyBox(a) +#define IDirect3DRMFrame2_SetBox(p,a) (p)->SetBox(a) +#define IDirect3DRMFrame2_SetBoxEnable(p,a) (p)->SetBoxEnable(a) +#define IDirect3DRMFrame2_SetAxes(p,a,b,c,d,e,f) (p)->SetAxes(a,b,c,d,e,f) +#define IDirect3DRMFrame2_SetInheritAxes(p,a) (p)->SetInheritAxes(a) +#define IDirect3DRMFrame2_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DRMFrame2_SetQuaternion(p,a,b) (p)->SetQuaternion(a,b) +#define IDirect3DRMFrame2_RayPick(p,a,b,c,d) (p)->RayPick(a,b,c,d) +#define IDirect3DRMFrame2_Save(p,a,b,c) (p)->Save(a,b,c) +#endif + +/***************************************************************************** + * IDirect3DRMFrame3 interface + */ +#define INTERFACE IDirect3DRMFrame3 +DECLARE_INTERFACE_(IDirect3DRMFrame3,IDirect3DRMVisual) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMFrame3 methods ***/ + STDMETHOD(AddChild)(THIS_ IDirect3DRMFrame3 *child) PURE; + STDMETHOD(AddLight)(THIS_ struct IDirect3DRMLight *light) PURE; + STDMETHOD(AddMoveCallback)(THIS_ D3DRMFRAME3MOVECALLBACK cb, void *ctx, DWORD flags) PURE; + STDMETHOD(AddTransform)(THIS_ D3DRMCOMBINETYPE, D3DRMMATRIX4D) PURE; + STDMETHOD(AddTranslation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScale)(THIS_ D3DRMCOMBINETYPE, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(AddRotation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(AddVisual)(THIS_ IUnknown *visual) PURE; + STDMETHOD(GetChildren)(THIS_ struct IDirect3DRMFrameArray **children) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; + STDMETHOD(GetLights)(THIS_ struct IDirect3DRMLightArray **lights) PURE; + STDMETHOD_(D3DRMMATERIALMODE, GetMaterialMode)(THIS) PURE; + STDMETHOD(GetParent)(THIS_ IDirect3DRMFrame3 **parent) PURE; + STDMETHOD(GetPosition)(THIS_ IDirect3DRMFrame3 *reference, D3DVECTOR *return_position) PURE; + STDMETHOD(GetRotation)(THIS_ IDirect3DRMFrame3 *reference, D3DVECTOR *axis, D3DVALUE *return_theta) PURE; + STDMETHOD(GetScene)(THIS_ IDirect3DRMFrame3 **scene) PURE; + STDMETHOD_(D3DRMSORTMODE, GetSortMode)(THIS) PURE; + STDMETHOD(GetTexture)(THIS_ struct IDirect3DRMTexture3 **texture) PURE; + STDMETHOD(GetTransform)(THIS_ IDirect3DRMFrame3 *reference, D3DRMMATRIX4D matrix) PURE; + STDMETHOD(GetVelocity)(THIS_ IDirect3DRMFrame3 *reference, D3DVECTOR *return_velocity, BOOL with_rotation) PURE; + STDMETHOD(GetOrientation)(THIS_ IDirect3DRMFrame3 *reference, D3DVECTOR *dir, D3DVECTOR *up) PURE; + STDMETHOD(GetVisuals)(THIS_ DWORD *count, IUnknown **visuals) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + STDMETHOD(Load)(THIS_ void *filename, void *name, D3DRMLOADOPTIONS flags, + D3DRMLOADTEXTURE3CALLBACK cb, void *ctx) PURE; + STDMETHOD(LookAt)(THIS_ IDirect3DRMFrame3 *target, IDirect3DRMFrame3 *reference, + D3DRMFRAMECONSTRAINT constraint) PURE; + STDMETHOD(Move)(THIS_ D3DVALUE delta) PURE; + STDMETHOD(DeleteChild)(THIS_ IDirect3DRMFrame3 *child) PURE; + STDMETHOD(DeleteLight)(THIS_ struct IDirect3DRMLight *light) PURE; + STDMETHOD(DeleteMoveCallback)(THIS_ D3DRMFRAME3MOVECALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteVisual)(THIS_ IUnknown *visual) PURE; + STDMETHOD_(D3DCOLOR, GetSceneBackground)(THIS) PURE; + STDMETHOD(GetSceneBackgroundDepth)(THIS_ IDirectDrawSurface **surface) PURE; + STDMETHOD_(D3DCOLOR, GetSceneFogColor)(THIS) PURE; + STDMETHOD_(BOOL, GetSceneFogEnable)(THIS) PURE; + STDMETHOD_(D3DRMFOGMODE, GetSceneFogMode)(THIS) PURE; + STDMETHOD(GetSceneFogParams)(THIS_ D3DVALUE *return_start, D3DVALUE *return_end, + D3DVALUE *return_density) PURE; + STDMETHOD(SetSceneBackground)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneBackgroundRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetSceneBackgroundDepth)(THIS_ IDirectDrawSurface *surface) PURE; + STDMETHOD(SetSceneBackgroundImage)(THIS_ struct IDirect3DRMTexture3 *texture) PURE; + STDMETHOD(SetSceneFogEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetSceneFogColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneFogMode)(THIS_ D3DRMFOGMODE) PURE; + STDMETHOD(SetSceneFogParams)(THIS_ D3DVALUE start, D3DVALUE end, D3DVALUE density) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD_(D3DRMZBUFFERMODE, GetZbufferMode)(THIS) PURE; + STDMETHOD(SetMaterialMode)(THIS_ D3DRMMATERIALMODE) PURE; + STDMETHOD(SetOrientation)(THIS_ IDirect3DRMFrame3 *reference, D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz) PURE; + STDMETHOD(SetPosition)(THIS_ IDirect3DRMFrame3 *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetRotation)(THIS_ IDirect3DRMFrame3 *reference, + D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(SetSortMode)(THIS_ D3DRMSORTMODE) PURE; + STDMETHOD(SetTexture)(THIS_ struct IDirect3DRMTexture3 *texture) PURE; + STDMETHOD(SetVelocity)(THIS_ IDirect3DRMFrame3 *reference, + D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation) PURE; + STDMETHOD(SetZbufferMode)(THIS_ D3DRMZBUFFERMODE) PURE; + STDMETHOD(Transform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *box) PURE; + STDMETHOD_(BOOL, GetBoxEnable)(THIS) PURE; + STDMETHOD(GetAxes)(THIS_ D3DVECTOR *dir, D3DVECTOR *up); + STDMETHOD(GetMaterial)(THIS_ struct IDirect3DRMMaterial2 **material) PURE; + STDMETHOD_(BOOL, GetInheritAxes)(THIS); + STDMETHOD(GetHierarchyBox)(THIS_ D3DRMBOX *box) PURE; + STDMETHOD(SetBox)(THIS_ D3DRMBOX *box) PURE; + STDMETHOD(SetBoxEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetAxes)(THIS_ D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz); + STDMETHOD(SetInheritAxes)(THIS_ BOOL inherit_from_parent); + STDMETHOD(SetMaterial)(THIS_ struct IDirect3DRMMaterial2 *material) PURE; + STDMETHOD(SetQuaternion)(THIS_ IDirect3DRMFrame3 *reference, D3DRMQUATERNION *q) PURE; + STDMETHOD(RayPick)(THIS_ IDirect3DRMFrame3 *reference, D3DRMRAY *ray, DWORD flags, + struct IDirect3DRMPicked2Array **return_visuals) PURE; + STDMETHOD(Save)(THIS_ const char *filename, D3DRMXOFFORMAT format, D3DRMSAVEOPTIONS flags); + STDMETHOD(TransformVectors)(THIS_ IDirect3DRMFrame3 *reference, DWORD vector_count, + D3DVECTOR *dst_vectors, D3DVECTOR *src_vectors) PURE; + STDMETHOD(InverseTransformVectors)(THIS_ IDirect3DRMFrame3 *reference, DWORD vector_count, + D3DVECTOR *dst_vectors, D3DVECTOR *src_vectors) PURE; + STDMETHOD(SetTraversalOptions)(THIS_ DWORD flags) PURE; + STDMETHOD(GetTraversalOptions)(THIS_ DWORD *flags) PURE; + STDMETHOD(SetSceneFogMethod)(THIS_ DWORD flags) PURE; + STDMETHOD(GetSceneFogMethod)(THIS_ DWORD *fog_mode) PURE; + STDMETHOD(SetMaterialOverride)(THIS_ D3DRMMATERIALOVERRIDE *override) PURE; + STDMETHOD(GetMaterialOverride)(THIS_ D3DRMMATERIALOVERRIDE *override) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMFrame3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMFrame3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMFrame3_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMFrame3_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMFrame3_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMFrame3_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMFrame3_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMFrame3_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMFrame3_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMFrame3_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMFrame3_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMFrame3 methods ***/ +#define IDirect3DRMFrame3_AddChild(p,a) (p)->lpVtbl->AddChild(p,a) +#define IDirect3DRMFrame3_AddLight(p,a) (p)->lpVtbl->AddLight(p,a) +#define IDirect3DRMFrame3_AddMoveCallback(p,a,b,c) (p)->lpVtbl->AddMoveCallback(p,a,b,c) +#define IDirect3DRMFrame3_AddTransform(p,a,b) (p)->lpVtbl->AddTransform(p,a,b) +#define IDirect3DRMFrame3_AddTranslation(p,a,b,c,d) (p)->lpVtbl->AddTranslation(p,a,b,c,d) +#define IDirect3DRMFrame3_AddScale(p,a,b,c,d) (p)->lpVtbl->AddScale(p,a,b,c,d) +#define IDirect3DRMFrame3_AddRotation(p,a,b,c,d,e) (p)->lpVtbl->AddRotation(p,a,b,c,d,e) +#define IDirect3DRMFrame3_AddVisual(p,a) (p)->lpVtbl->AddVisual(p,a) +#define IDirect3DRMFrame3_GetChildren(p,a) (p)->lpVtbl->GetChildren(p,a) +#define IDirect3DRMFrame3_GetColor(p) (p)->lpVtbl->GetColor(p) +#define IDirect3DRMFrame3_GetLights(p,a) (p)->lpVtbl->GetLights(p,a) +#define IDirect3DRMFrame3_GetMaterialMode(p) (p)->lpVtbl->GetMaterialMode(p) +#define IDirect3DRMFrame3_GetParent(p,a) (p)->lpVtbl->GetParent(p,a) +#define IDirect3DRMFrame3_GetPosition(p,a,b) (p)->lpVtbl->GetPosition(p,a,b) +#define IDirect3DRMFrame3_GetRotation(p,a,b,c) (p)->lpVtbl->GetRotation(p,a,b,c) +#define IDirect3DRMFrame3_GetScene(p,a) (p)->lpVtbl->GetScene(p,a) +#define IDirect3DRMFrame3_GetSortMode(p) (p)->lpVtbl->GetSortMode(p) +#define IDirect3DRMFrame3_GetTexture(p,a) (p)->lpVtbl->GetTexture(p,a) +#define IDirect3DRMFrame3_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DRMFrame3_GetVelocity(p,a,b,c) (p)->lpVtbl->GetVelocity(p,a,b,c) +#define IDirect3DRMFrame3_GetOrientation(p,a,b,c) (p)->lpVtbl->GetOrientation(p,a,b,c) +#define IDirect3DRMFrame3_GetVisuals(p,a,b) (p)->lpVtbl->GetVisuals(p,a,b) +#define IDirect3DRMFrame3_InverseTransform(p,a,b) (p)->lpVtbl->InverseTransform(p,a,b) +#define IDirect3DRMFrame3_Load(p,a,b,c,d,e) (p)->lpVtbl->Load(p,a,b,c,d,e) +#define IDirect3DRMFrame3_LookAt(p,a,b,c) (p)->lpVtbl->LookAt(p,a,b,c) +#define IDirect3DRMFrame3_Move(p,a) (p)->lpVtbl->Move(p,a) +#define IDirect3DRMFrame3_DeleteChild(p,a) (p)->lpVtbl->DeleteChild(p,a) +#define IDirect3DRMFrame3_DeleteLight(p,a) (p)->lpVtbl->DeleteLight(p,a) +#define IDirect3DRMFrame3_DeleteMoveCallback(p,a,b) (p)->lpVtbl->DeleteMoveCallback(p,a,b) +#define IDirect3DRMFrame3_DeleteVisual(p,a) (p)->lpVtbl->DeleteVisual(p,a) +#define IDirect3DRMFrame3_GetSceneBackground(p) (p)->lpVtbl->GetSceneBackground(p) +#define IDirect3DRMFrame3_GetSceneBackgroundDepth(p,a) (p)->lpVtbl->GetSceneBackgroundDepth(p,a) +#define IDirect3DRMFrame3_GetSceneFogColor(p) (p)->lpVtbl->GetSceneFogColor(p) +#define IDirect3DRMFrame3_GetSceneFogEnable(p) (p)->lpVtbl->GetSceneFogEnable(p) +#define IDirect3DRMFrame3_GetSceneFogMode(p) (p)->lpVtbl->GetSceneFogMode(p) +#define IDirect3DRMFrame3_GetSceneFogParams(p,a,b,c) (p)->lpVtbl->GetSceneFogParams(p,a,b,c) +#define IDirect3DRMFrame3_SetSceneBackground(p,a) (p)->lpVtbl->SetSceneBackground(p,a) +#define IDirect3DRMFrame3_SetSceneBackgroundRGB(p,a,b,c) (p)->lpVtbl->SetSceneBackgroundRGB(p,a,b,c) +#define IDirect3DRMFrame3_SetSceneBackgroundDepth(p,a) (p)->lpVtbl->SetSceneBackgroundDepth(p,a) +#define IDirect3DRMFrame3_SetSceneBackgroundImage(p,a) (p)->lpVtbl->SetSceneBackgroundImage(p,a) +#define IDirect3DRMFrame3_SetSceneFogEnable(p,a) (p)->lpVtbl->SetSceneFogEnable(p,a) +#define IDirect3DRMFrame3_SetSceneFogColor(p,a) (p)->lpVtbl->SetSceneFogColor(p,a) +#define IDirect3DRMFrame3_SetSceneFogMode(p,a) (p)->lpVtbl->SetSceneFogMode(p,a) +#define IDirect3DRMFrame3_SetSceneFogParams(p,a,b,c) (p)->lpVtbl->SetSceneFogParams(p,a,b,c) +#define IDirect3DRMFrame3_SetColor(p,a) (p)->lpVtbl->SetColor(p,a) +#define IDirect3DRMFrame3_SetColorRGB(p,a,b,c) (p)->lpVtbl->SetColorRGB(p,a,b,c) +#define IDirect3DRMFrame3_GetZbufferMode(p) (p)->lpVtbl->GetZbufferMode(p) +#define IDirect3DRMFrame3_SetMaterialMode(p,a) (p)->lpVtbl->SetMaterialMode(p,a) +#define IDirect3DRMFrame3_SetOrientation(p,a,b,c,d,e,f,g) (p)->lpVtbl->SetOrientation(p,a,b,c,d,e,f,g) +#define IDirect3DRMFrame3_SetPosition(p,a,b,c,d) (p)->lpVtbl->SetPosition(p,a,b,c,d) +#define IDirect3DRMFrame3_SetRotation(p,a,b,c,d,e) (p)->lpVtbl->SetRotation(p,a,b,c,d,e) +#define IDirect3DRMFrame3_SetSortMode(p,a) (p)->lpVtbl->SetSortMode(p,a) +#define IDirect3DRMFrame3_SetTexture(p,a) (p)->lpVtbl->SetTexture(p,a) +#define IDirect3DRMFrame3_SetVelocity(p,a,b,c,d,e) (p)->lpVtbl->SetVelocity(p,a,b,c,d,e) +#define IDirect3DRMFrame3_SetZbufferMode(p,a) (p)->lpVtbl->SetZbufferMode(p,a) +#define IDirect3DRMFrame3_Transform(p,a,b) (p)->lpVtbl->Transform(p,a,b) +#define IDirect3DRMFrame3_GetBox(p,a) (p)->lpVtbl->GetBox(p,a) +#define IDirect3DRMFrame3_GetBoxEnable(p) (p)->lpVtbl->GetBoxEnable(p) +#define IDirect3DRMFrame3_GetAxes(p,a,b) (p)->lpVtbl->GetAxes(p,a,b) +#define IDirect3DRMFrame3_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DRMFrame3_GetInheritAxes(p) (p)->lpVtbl->GetInheritAxes(p) +#define IDirect3DRMFrame3_GetHierarchyBox(p,a) (p)->lpVtbl->GetHierarchyBox(p,a) +#define IDirect3DRMFrame3_SetBox(p,a) (p)->lpVtbl->SetBox(p,a) +#define IDirect3DRMFrame3_SetBoxEnable(p,a) (p)->lpVtbl->SetBoxEnable(p,a) +#define IDirect3DRMFrame3_SetAxes(p,a,b,c,d,e,f) (p)->lpVtbl->SetAxes(p,a,b,c,d,e,f) +#define IDirect3DRMFrame3_SetInheritAxes(p,a) (p)->lpVtbl->SetInheritAxes(p,a) +#define IDirect3DRMFrame3_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DRMFrame3_SetQuaternion(p,a,b) (p)->lpVtbl->SetQuaternion(p,a,b) +#define IDirect3DRMFrame3_RayPick(p,a,b,c,d) (p)->lpVtbl->RayPick(p,a,b,c,d) +#define IDirect3DRMFrame3_Save(p,a,b,c) (p)->lpVtbl->Save(p,a,b,c) +#define IDirect3DRMFrame3_TransformVectors(p,a,b,c,d) (p)->lpVtbl->TransformVectors(p,a,b,c,d) +#define IDirect3DRMFrame3_InverseTransformVectors(p,a,b,c,d) (p)->lpVtbl->InverseTransformVectors(p,a,b,c,d) +#define IDirect3DRMFrame3_SetTraversalOptions(p,a) (p)->lpVtbl->SetTraversalOptions(p,a) +#define IDirect3DRMFrame3_GetTraversalOptions(p,a) (p)->lpVtbl->GetTraversalOptions(p,a) +#define IDirect3DRMFrame3_SetSceneFogMethod(p,a) (p)->lpVtbl->SetSceneFogMethod(p,a) +#define IDirect3DRMFrame3_GetSceneFogMethod(p,a) (p)->lpVtbl->GetSceneFogMethod(p,a) +#define IDirect3DRMFrame3_SetMaterialOverride(p,a) (p)->lpVtbl->SetMaterialOverride(p,a) +#define IDirect3DRMFrame3_GetMaterialOverride(p,a) (p)->lpVtbl->GetMaterialOverride(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMFrame3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMFrame3_AddRef(p) (p)->AddRef() +#define IDirect3DRMFrame3_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMFrame3_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMFrame3_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMFrame3_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMFrame3_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMFrame3_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMFrame3_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMFrame3_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMFrame3_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMFrame3 methods ***/ +#define IDirect3DRMFrame3_AddChild(p,a) (p)->AddChild(a) +#define IDirect3DRMFrame3_AddLight(p,a) (p)->AddLight(a) +#define IDirect3DRMFrame3_AddMoveCallback(p,a,b,c) (p)->AddMoveCallback(a,b,c) +#define IDirect3DRMFrame3_AddTransform(p,a,b) (p)->AddTransform(a,b) +#define IDirect3DRMFrame3_AddTranslation(p,a,b,c,d) (p)->AddTranslation(a,b,c,d) +#define IDirect3DRMFrame3_AddScale(p,a,b,c,d) (p)->AddScale(a,b,c,d) +#define IDirect3DRMFrame3_AddRotation(p,a,b,c,d,e) (p)->AddRotation(a,b,c,d,e) +#define IDirect3DRMFrame3_AddVisual(p,a) (p)->AddVisual(a) +#define IDirect3DRMFrame3_GetChildren(p,a) (p)->GetChildren(a) +#define IDirect3DRMFrame3_GetColor(p) (p)->GetColor() +#define IDirect3DRMFrame3_GetLights(p,a) (p)->GetLights(a) +#define IDirect3DRMFrame3_GetMaterialMode(p) (p)->GetMaterialMode() +#define IDirect3DRMFrame3_GetParent(p,a) (p)->GetParent(a) +#define IDirect3DRMFrame3_GetPosition(p,a,b) (p)->GetPosition(a,b) +#define IDirect3DRMFrame3_GetRotation(p,a,b,c) (p)->GetRotation(a,b,c) +#define IDirect3DRMFrame3_GetScene(p,a) (p)->GetScene(a) +#define IDirect3DRMFrame3_GetSortMode(p) (p)->GetSortMode() +#define IDirect3DRMFrame3_GetTexture(p,a) (p)->GetTexture(a) +#define IDirect3DRMFrame3_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DRMFrame3_GetVelocity(p,a,b,c) (p)->GetVelocity(a,b,c) +#define IDirect3DRMFrame3_GetOrientation(p,a,b,c) (p)->GetOrientation(a,b,c) +#define IDirect3DRMFrame3_GetVisuals(p,a,b) (p)->GetVisuals(a,b) +#define IDirect3DRMFrame3_InverseTransform(p,a,b) (p)->InverseTransform(a,b) +#define IDirect3DRMFrame3_Load(p,a,b,c,d,e) (p)->Load(a,b,c,d,e) +#define IDirect3DRMFrame3_LookAt(p,a,b,c) (p)->LookAt(a,b,c) +#define IDirect3DRMFrame3_Move(p,a) (p)->Move(a) +#define IDirect3DRMFrame3_DeleteChild(p,a) (p)->DeleteChild(a) +#define IDirect3DRMFrame3_DeleteLight(p,a) (p)->DeleteLight(a) +#define IDirect3DRMFrame3_DeleteMoveCallback(p,a,b) (p)->DeleteMoveCallback(a,b) +#define IDirect3DRMFrame3_DeleteVisual(p,a) (p)->DeleteVisual(a) +#define IDirect3DRMFrame3_GetSceneBackground(p) (p)->GetSceneBackground() +#define IDirect3DRMFrame3_GetSceneBackgroundDepth(p,a) (p)->GetSceneBackgroundDepth(a) +#define IDirect3DRMFrame3_GetSceneFogColor(p) (p)->GetSceneFogColor() +#define IDirect3DRMFrame3_GetSceneFogEnable(p) (p)->GetSceneFogEnable() +#define IDirect3DRMFrame3_GetSceneFogMode(p) (p)->GetSceneFogMode() +#define IDirect3DRMFrame3_GetSceneFogParams(p,a,b,c) (p)->GetSceneFogParams(a,b,c) +#define IDirect3DRMFrame3_SetSceneBackground(p,a) (p)->SetSceneBackground(a) +#define IDirect3DRMFrame3_SetSceneBackgroundRGB(p,a,b,c) (p)->SetSceneBackgroundRGB(a,b,c) +#define IDirect3DRMFrame3_SetSceneBackgroundDepth(p,a) (p)->SetSceneBackgroundDepth(a) +#define IDirect3DRMFrame3_SetSceneBackgroundImage(p,a) (p)->SetSceneBackgroundImage(a) +#define IDirect3DRMFrame3_SetSceneFogEnable(p,a) (p)->SetSceneFogEnable(a) +#define IDirect3DRMFrame3_SetSceneFogColor(p,a) (p)->SetSceneFogColor(a) +#define IDirect3DRMFrame3_SetSceneFogMode(p,a) (p)->SetSceneFogMode(a) +#define IDirect3DRMFrame3_SetSceneFogParams(p,a,b,c) (p)->SetSceneFogParams(a,b,c) +#define IDirect3DRMFrame3_SetColor(p,a) (p)->SetColor(a) +#define IDirect3DRMFrame3_SetColorRGB(p,a,b,c) (p)->SetColorRGB(a,b,c) +#define IDirect3DRMFrame3_GetZbufferMode(p) (p)->GetZbufferMode() +#define IDirect3DRMFrame3_SetMaterialMode(p,a) (p)->SetMaterialMode(a) +#define IDirect3DRMFrame3_SetOrientation(p,a,b,c,d,e,f,g) (p)->SetOrientation(a,b,c,d,e,f,g) +#define IDirect3DRMFrame3_SetPosition(p,a,b,c,d) (p)->SetPosition(a,b,c,d) +#define IDirect3DRMFrame3_SetRotation(p,a,b,c,d,e) (p)->SetRotation(a,b,c,d,e) +#define IDirect3DRMFrame3_SetSortMode(p,a) (p)->SetSortMode(a) +#define IDirect3DRMFrame3_SetTexture(p,a) (p)->SetTexture(a) +#define IDirect3DRMFrame3_SetVelocity(p,a,b,c,d,e) (p)->SetVelocity(a,b,c,d,e) +#define IDirect3DRMFrame3_SetZbufferMode(p,a) (p)->SetZbufferMode(a) +#define IDirect3DRMFrame3_Transform(p,a,b) (p)->Transform(a,b) +#define IDirect3DRMFrame3_GetBox(p,a) (p)->GetBox(a) +#define IDirect3DRMFrame3_GetBoxEnable(p) (p)->GetBoxEnable() +#define IDirect3DRMFrame3_GetAxes(p,a,b) (p)->GetAxes(a,b) +#define IDirect3DRMFrame3_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DRMFrame3_GetInheritAxes(p) (p)->GetInheritAxes() +#define IDirect3DRMFrame3_GetHierarchyBox(p,a) (p)->GetHierarchyBox(a) +#define IDirect3DRMFrame3_SetBox(p,a) (p)->SetBox(a) +#define IDirect3DRMFrame3_SetBoxEnable(p,a) (p)->SetBoxEnable(a) +#define IDirect3DRMFrame3_SetAxes(p,a,b,c,d,e,f) (p)->SetAxes(a,b,c,d,e,f) +#define IDirect3DRMFrame3_SetInheritAxes(p,a) (p)->SetInheritAxes(a) +#define IDirect3DRMFrame3_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DRMFrame3_SetQuaternion(p,a,b) (p)->SetQuaternion(a,b) +#define IDirect3DRMFrame3_RayPick(p,a,b,c,d) (p)->RayPick(a,b,c,d) +#define IDirect3DRMFrame3_Save(p,a,b,c) (p)->Save(a,b,c) +#define IDirect3DRMFrame3_TransformVectors(p,a,b,c,d) (p)->TransformVectors(a,b,c,d) +#define IDirect3DRMFrame3_InverseTransformVectors(p,a,b,c,d) (p)->InverseTransformVectors(a,b,c,d) +#define IDirect3DRMFrame3_SetTraversalOptions(p,a) (p)->SetTraversalOptions(a) +#define IDirect3DRMFrame3_GetTraversalOptions(p,a) (p)->GetTraversalOptions(a) +#define IDirect3DRMFrame3_SetSceneFogMethod(p,a) (p)->SetSceneFogMethod(a) +#define IDirect3DRMFrame3_GetSceneFogMethod(p,a) (p)->GetSceneFogMethod(a) +#define IDirect3DRMFrame3_SetMaterialOverride(p,a) (p)->SetMaterialOverride(a) +#define IDirect3DRMFrame3_GetMaterialOverride(p,a) (p)->GetMaterialOverride(a) +#endif + +/***************************************************************************** + * IDirect3DRMMesh interface + */ +#define INTERFACE IDirect3DRMMesh +DECLARE_INTERFACE_(IDirect3DRMMesh,IDirect3DRMVisual) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMMesh methods ***/ + STDMETHOD(Scale)(THIS_ D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(Translate)(THIS_ D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *) PURE; + STDMETHOD(AddGroup)(THIS_ unsigned vCount, unsigned fCount, unsigned vPerFace, unsigned *fData, + D3DRMGROUPINDEX *returnId) PURE; + STDMETHOD(SetVertices)(THIS_ D3DRMGROUPINDEX id, unsigned index, unsigned count, + D3DRMVERTEX *values) PURE; + STDMETHOD(SetGroupColor)(THIS_ D3DRMGROUPINDEX id, D3DCOLOR value) PURE; + STDMETHOD(SetGroupColorRGB)(THIS_ D3DRMGROUPINDEX id, D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetGroupMapping)(THIS_ D3DRMGROUPINDEX id, D3DRMMAPPING value) PURE; + STDMETHOD(SetGroupQuality)(THIS_ D3DRMGROUPINDEX id, D3DRMRENDERQUALITY value) PURE; + STDMETHOD(SetGroupMaterial)(THIS_ D3DRMGROUPINDEX id, struct IDirect3DRMMaterial *material) PURE; + STDMETHOD(SetGroupTexture)(THIS_ D3DRMGROUPINDEX id, struct IDirect3DRMTexture *texture) PURE; + STDMETHOD_(unsigned, GetGroupCount)(THIS) PURE; + STDMETHOD(GetGroup)(THIS_ D3DRMGROUPINDEX id, unsigned *vCount, unsigned *fCount, unsigned *vPerFace, + DWORD *fDataSize, unsigned *fData) PURE; + STDMETHOD(GetVertices)(THIS_ D3DRMGROUPINDEX id, DWORD index, DWORD count, D3DRMVERTEX *returnPtr) PURE; + STDMETHOD_(D3DCOLOR, GetGroupColor)(THIS_ D3DRMGROUPINDEX id) PURE; + STDMETHOD_(D3DRMMAPPING, GetGroupMapping)(THIS_ D3DRMGROUPINDEX id) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetGroupQuality)(THIS_ D3DRMGROUPINDEX id) PURE; + STDMETHOD(GetGroupMaterial)(THIS_ D3DRMGROUPINDEX id, struct IDirect3DRMMaterial **material) PURE; + STDMETHOD(GetGroupTexture)(THIS_ D3DRMGROUPINDEX id, struct IDirect3DRMTexture **texture) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMMesh_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMMesh_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMMesh_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMMesh_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMMesh_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMMesh_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMMesh_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMMesh_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMMesh_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMMesh_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMMesh_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMMesh methods ***/ +#define IDirect3DRMMesh_Scale(p,a,b,c) (p)->lpVtbl->Scale(p,a,b,c) +#define IDirect3DRMMesh_Translate(p,a,b,c) (p)->lpVtbl->Translate(p,a,b,c) +#define IDirect3DRMMesh_GetBox(p,a) (p)->lpVtbl->GetBox(p,a) +#define IDirect3DRMMesh_AddGroup(p,a,b,c,d,e) (p)->lpVtbl->AddGroup(p,a,b,c,d,e) +#define IDirect3DRMMesh_SetVertices(p,a,b,c,d) (p)->lpVtbl->SetVertices(p,a,b,c,d) +#define IDirect3DRMMesh_SetGroupColor(p,a,b) (p)->lpVtbl->SetGroupColor(p,a,b) +#define IDirect3DRMMesh_SetGroupColorRGB(p,a,b,c,d) (p)->lpVtbl->SetGroupColorRGB(p,a,b,c,d) +#define IDirect3DRMMesh_SetGroupMapping(p,a,b) (p)->lpVtbl->SetGroupMapping(p,a,b) +#define IDirect3DRMMesh_SetGroupQuality(p,a,b) (p)->lpVtbl->SetGroupQuality(p,a,b) +#define IDirect3DRMMesh_SetGroupMaterial(p,a,b) (p)->lpVtbl->SetGroupMaterial(p,a,b) +#define IDirect3DRMMesh_SetGroupTexture(p,a,b) (p)->lpVtbl->SetGroupTexture(p,a,b) +#define IDirect3DRMMesh_GetGroupCount(p) (p)->lpVtbl->GetGroupCount(p) +#define IDirect3DRMMesh_GetGroup(p,a,b,c,d,e,f) (p)->lpVtbl->GetGroup(p,a,b,c,d,e,f) +#define IDirect3DRMMesh_GetVertices(p,a,b,c,d) (p)->lpVtbl->GetVertices(p,a,b,c,d) +#define IDirect3DRMMesh_GetGroupColor(p,a) (p)->lpVtbl->GetGroupColor(p,a) +#define IDirect3DRMMesh_GetGroupMapping(p,a) (p)->lpVtbl->GetGroupMapping(p,a) +#define IDirect3DRMMesh_GetGroupQuality(p,a) (p)->lpVtbl->GetGroupQuality(p,a) +#define IDirect3DRMMesh_GetGroupMaterial(p,a,b) (p)->lpVtbl->GetGroupMaterial(p,a,b) +#define IDirect3DRMMesh_GetGroupTexture(p,a,b) (p)->lpVtbl->GetGroupTexture(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMMesh_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMMesh_AddRef(p) (p)->AddRef() +#define IDirect3DRMMesh_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMMesh_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMMesh_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMMesh_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMMesh_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMMesh_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMMesh_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMMesh_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMMesh_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMMesh methods ***/ +#define IDirect3DRMMesh_Scale(p,a,b,c) (p)->Scale(a,b,c) +#define IDirect3DRMMesh_Translate(p,a,b,c) (p)->Translate(a,b,c) +#define IDirect3DRMMesh_GetBox(p,a) (p)->GetBox(a) +#define IDirect3DRMMesh_AddGroup(p,a,b,c,d,e) (p)->AddGroup(a,b,c,d,e) +#define IDirect3DRMMesh_SetVertices(p,a,b,c,d) (p)->SetVertices(a,b,c,d) +#define IDirect3DRMMesh_SetGroupColor(p,a,b) (p)->SetGroupColor(a,b) +#define IDirect3DRMMesh_SetGroupColorRGB(p,a,b,c,d) (p)->SetGroupColorRGB(a,b,c,d) +#define IDirect3DRMMesh_SetGroupMapping(p,a,b) (p)->SetGroupMapping(a,b) +#define IDirect3DRMMesh_SetGroupQuality(p,a,b) (p)->SetGroupQuality(a,b) +#define IDirect3DRMMesh_SetGroupMaterial(p,a,b) (p)->SetGroupMaterial(a,b) +#define IDirect3DRMMesh_SetGroupTexture(p,a,b) (p)->SetGroupTexture(a,b) +#define IDirect3DRMMesh_GetGroupCount(p) (p)->GetGroupCount() +#define IDirect3DRMMesh_GetGroup(p,a,b,c,d,e,f) (p)->GetGroup(a,b,c,d,e,f) +#define IDirect3DRMMesh_GetVertices(p,a,b,c,d) (p)->GetVertices(a,b,c,d) +#define IDirect3DRMMesh_GetGroupColor(p,a) (p)->GetGroupColor(a) +#define IDirect3DRMMesh_GetGroupMapping(p,a) (p)->GetGroupMapping(a) +#define IDirect3DRMMesh_GetGroupQuality(p,a) (p)->GetGroupQuality(a) +#define IDirect3DRMMesh_GetGroupMaterial(p,a,b) (p)->GetGroupMaterial(a,b) +#define IDirect3DRMMesh_GetGroupTexture(p,a,b) (p)->GetGroupTexture(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMProgressiveMesh interface + */ +#define INTERFACE IDirect3DRMProgressiveMesh +DECLARE_INTERFACE_(IDirect3DRMProgressiveMesh,IDirect3DRMVisual) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMProgressiveMesh methods ***/ + STDMETHOD(Load) (THIS_ void *filename, void *name, D3DRMLOADOPTIONS flags, + D3DRMLOADTEXTURECALLBACK cb, void *ctx) PURE; + STDMETHOD(GetLoadStatus) (THIS_ D3DRMPMESHLOADSTATUS *status) PURE; + STDMETHOD(SetMinRenderDetail) (THIS_ D3DVALUE d3dVal) PURE; + STDMETHOD(Abort) (THIS_ DWORD flags) PURE; + STDMETHOD(GetFaceDetail) (THIS_ DWORD *count) PURE; + STDMETHOD(GetVertexDetail) (THIS_ DWORD *count) PURE; + STDMETHOD(SetFaceDetail) (THIS_ DWORD count) PURE; + STDMETHOD(SetVertexDetail) (THIS_ DWORD count) PURE; + STDMETHOD(GetFaceDetailRange) (THIS_ DWORD *min_detail, DWORD *max_detail) PURE; + STDMETHOD(GetVertexDetailRange) (THIS_ DWORD *min_detail, DWORD *max_detail) PURE; + STDMETHOD(GetDetail) (THIS_ D3DVALUE *pdvVal) PURE; + STDMETHOD(SetDetail) (THIS_ D3DVALUE d3dVal) PURE; + STDMETHOD(RegisterEvents) (THIS_ HANDLE event, DWORD flags, DWORD reserved) PURE; + STDMETHOD(CreateMesh) (THIS_ IDirect3DRMMesh **mesh) PURE; + STDMETHOD(Duplicate) (THIS_ IDirect3DRMProgressiveMesh **mesh) PURE; + STDMETHOD(GetBox) (THIS_ D3DRMBOX *box) PURE; + STDMETHOD(SetQuality) (THIS_ D3DRMRENDERQUALITY quality) PURE; + STDMETHOD(GetQuality) (THIS_ D3DRMRENDERQUALITY *quality) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMProgressiveMesh_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMProgressiveMesh_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMProgressiveMesh_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMProgressiveMesh_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMProgressiveMesh_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMProgressiveMesh_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMProgressiveMesh_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMProgressiveMesh_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMProgressiveMesh_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMProgressiveMesh_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMProgressiveMesh_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMProgressiveMesh methods ***/ +#define IDirect3DRMProgressiveMesh_Load(p,a,b,c,d,e) (p)->lpVtbl->Load(p,a,b,c,d,e) +#define IDirect3DRMProgressiveMesh_GetLoadStatus(p,a) (p)->lpVtbl->GetLoadStatus(p,a) +#define IDirect3DRMProgressiveMesh_SetMinRenderDetail(p,a) (p)->lpVtbl->SetMinRenderDetail(p,a) +#define IDirect3DRMProgressiveMesh_Abort(p,a) (p)->lpVtbl->Abort(p,a) +#define IDirect3DRMProgressiveMesh_GetFaceDetail(p,a) (p)->lpVtbl->GetFaceDetail(p,a) +#define IDirect3DRMProgressiveMesh_GetVertexDetail(p,a) (p)->lpVtbl->GetVertexDetail(p,a) +#define IDirect3DRMProgressiveMesh_SetFaceDetail(p,a) (p)->lpVtbl->SetFaceDetail(p,a) +#define IDirect3DRMProgressiveMesh_SetVertexDetail(p,a) (p)->lpVtbl->SetVertexDetail(p,a) +#define IDirect3DRMProgressiveMesh_GetFaceDetailRange(p,a,b) (p)->lpVtbl->GetFaceDetailRange(p,a,b) +#define IDirect3DRMProgressiveMesh_GetVertexDetailRange(p,a,b) (p)->lpVtbl->GetVertexDetailRange(p,a,b) +#define IDirect3DRMProgressiveMesh_GetDetail(p,a) (p)->lpVtbl->GetDetail(p,a) +#define IDirect3DRMProgressiveMesh_SetDetail(p,a) (p)->lpVtbl->SetDetail(p,a) +#define IDirect3DRMProgressiveMesh_RegisterEvents(p,a,b,c) (p)->lpVtbl->RegisterEvents(p,a,b,c) +#define IDirect3DRMProgressiveMesh_CreateMesh(p,a) (p)->lpVtbl->CreateMesh(p,a) +#define IDirect3DRMProgressiveMesh_Duplicate(p,a) (p)->lpVtbl->Duplicate(p,a) +#define IDirect3DRMProgressiveMesh_GetBox(p,a) (p)->lpVtbl->GetBox(p,a) +#define IDirect3DRMProgressiveMesh_SetQuality(p,a) (p)->lpVtbl->SetQuality(p,a) +#define IDirect3DRMProgressiveMesh_GetQuality(p,a) (p)->lpVtbl->GetQuality(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMProgressiveMesh_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMProgressiveMesh_AddRef(p) (p)->AddRef() +#define IDirect3DRMProgressiveMesh_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMProgressiveMesh_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMProgressiveMesh_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMProgressiveMesh_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMProgressiveMesh_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMProgressiveMesh_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMProgressiveMesh_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMProgressiveMesh_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMProgressiveMesh_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMProgressiveMesh methods ***/ +#define IDirect3DRMProgressiveMesh_Load(p,a,b,c,d,e) (p)->Load(a,b,c,d,e) +#define IDirect3DRMProgressiveMesh_GetLoadStatus(p,a) (p)->GetLoadStatus(a) +#define IDirect3DRMProgressiveMesh_SetMinRenderDetail(p,a) (p)->SetMinRenderDetail(a) +#define IDirect3DRMProgressiveMesh_Abort(p,a) (p)->Abort(a) +#define IDirect3DRMProgressiveMesh_GetFaceDetail(p,a) (p)->GetFaceDetail(a) +#define IDirect3DRMProgressiveMesh_GetVertexDetail(p,a) (p)->GetVertexDetail(a) +#define IDirect3DRMProgressiveMesh_SetFaceDetail(p,a) (p)->SetFaceDetail(a) +#define IDirect3DRMProgressiveMesh_SetVertexDetail(p,a) (p)->SetVertexDetail(a) +#define IDirect3DRMProgressiveMesh_GetFaceDetailRange(p,a,b) (p)->GetFaceDetailRange(a,b) +#define IDirect3DRMProgressiveMesh_GetVertexDetailRange(p,a,b) (p)->GetVertexDetailRange(a,b) +#define IDirect3DRMProgressiveMesh_GetDetail(p,a) (p)->GetDetail(a) +#define IDirect3DRMProgressiveMesh_SetDetail(p,a) (p)->SetDetail(a) +#define IDirect3DRMProgressiveMesh_RegisterEvents(p,a,b,c) (p)->RegisterEvents(a,b,c) +#define IDirect3DRMProgressiveMesh_CreateMesh(p,a) (p)->CreateMesh(a) +#define IDirect3DRMProgressiveMesh_Duplicate(p,a) (p)->Duplicate(a) +#define IDirect3DRMProgressiveMesh_GetBox(p,a) (p)->GetBox(a) +#define IDirect3DRMProgressiveMesh_SetQuality(p,a) (p)->SetQuality(a) +#define IDirect3DRMProgressiveMesh_GetQuality(p,a) (p)->GetQuality(a) +#endif + +/***************************************************************************** + * IDirect3DRMShadow interface + */ +#define INTERFACE IDirect3DRMShadow +DECLARE_INTERFACE_(IDirect3DRMShadow,IDirect3DRMVisual) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMShadow methods ***/ + STDMETHOD(Init)(THIS_ IDirect3DRMVisual *visual, struct IDirect3DRMLight *light, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMShadow_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMShadow_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMShadow_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMShadow_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMShadow_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMShadow_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMShadow_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMShadow_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMShadow_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMShadow_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMShadow_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMShadow methods ***/ +#define IDirect3DRMShadow_Init(p,a,b,c,d,e,f,g) (p)->lpVtbl->Load(p,a,b,c,d,e,f,g) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMShadow_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMShadow_AddRef(p) (p)->AddRef() +#define IDirect3DRMShadow_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMShadow_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMShadow_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMShadow_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMShadow_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMShadow_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMShadow_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMShadow_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMShadow_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMShadow methods ***/ +#define IDirect3DRMShadow_Init(p,a,b,c,d,e,f,g) (p)->Load(a,b,c,d,e,f,g) +#endif + +/***************************************************************************** + * IDirect3DRMShadow2 interface + */ +#define INTERFACE IDirect3DRMShadow2 +DECLARE_INTERFACE_(IDirect3DRMShadow2,IDirect3DRMVisual) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMShadow methods ***/ + STDMETHOD(Init)(THIS_ IUnknown *object, struct IDirect3DRMLight *light, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz) PURE; + /*** IDirect3DRMShadow2 methods ***/ + STDMETHOD(GetVisual)(THIS_ IDirect3DRMVisual **visual) PURE; + STDMETHOD(SetVisual)(THIS_ IUnknown *visual, DWORD flags) PURE; + STDMETHOD(GetLight)(THIS_ struct IDirect3DRMLight **light) PURE; + STDMETHOD(SetLight)(THIS_ struct IDirect3DRMLight *light, DWORD flags) PURE; + STDMETHOD(GetPlane)(THIS_ D3DVALUE *px, D3DVALUE *py, D3DVALUE *pz, + D3DVALUE *nx, D3DVALUE *ny, D3DVALUE *nz) PURE; + STDMETHOD(SetPlane)(THIS_ D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, DWORD) PURE; + STDMETHOD(GetOptions)(THIS_ DWORD *flags) PURE; + STDMETHOD(SetOptions)(THIS_ DWORD) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMShadow2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMShadow2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMShadow2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMShadow2_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMShadow2_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMShadow2_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMShadow2_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMShadow2_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMShadow2_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMShadow2_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMShadow2_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMShadow methods ***/ +#define IDirect3DRMShadow2_Init(p,a,b,c,d,e,f,g) (p)->lpVtbl->Init(p,a,b,c,d,e,f,g) +/*** IDirect3DRMShadow2 methods ***/ +#define IDirect3DRMShadow2_GetVisual(p,a) (p)->lpVtbl->GetVisual(p,a) +#define IDirect3DRMShadow2_SetVisual(p,a,b) (p)->lpVtbl->SetVisual(p,a,b) +#define IDirect3DRMShadow2_GetLight(p,a) (p)->lpVtbl->GetLight(p,a) +#define IDirect3DRMShadow2_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) +#define IDirect3DRMShadow2_GetPlane(p,a,b,c,d,e,f) (p)->lpVtbl->GetPlane(p,a,b,c,d,e,f) +#define IDirect3DRMShadow2_SetPlane(p,a,b,c,d,e,f) (p)->lpVtbl->SetPlane(p,a,b,c,d,e,f) +#define IDirect3DRMShadow2_GetOptions(p,a) (p)->lpVtbl->GetOptions(p,a) +#define IDirect3DRMShadow2_SetOptions(p,a) (p)->lpVtbl->SetOptions(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMShadow2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMShadow2_AddRef(p) (p)->AddRef() +#define IDirect3DRMShadow2_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMShadow2_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMShadow2_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMShadow2_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMShadow2_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMShadow2_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMShadow2_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMShadow2_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMShadow2_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMShadow methods ***/ +#define IDirect3DRMShadow2_Init(p,a,b,c,d,e,f,g) (p)->Init(a,b,c,d,e,f,g) +/*** IDirect3DRMShadow2 methods ***/ +#define IDirect3DRMShadow2_GetVisual(p,a) (p)->GetVisual(a) +#define IDirect3DRMShadow2_SetVisual(p,a,b) (p)->SetVisual(a,b) +#define IDirect3DRMShadow2_GetLight(p,a) (p)->GetLight(a) +#define IDirect3DRMShadow2_SetLight(p,a,b) (p)->SetLight(a,b) +#define IDirect3DRMShadow2_GetPlane(p,a,b,c,d,e,f) (p)->GetPlane(a,b,c,d,e,f) +#define IDirect3DRMShadow2_SetPlane(p,a,b,c,d,e,f) (p)->SetPlane(a,b,c,d,e,f) +#define IDirect3DRMShadow2_GetOptions(p,a) (p)->GetOptions(a) +#define IDirect3DRMShadow2_SetOptions(p,a) (p)->SetOptions(a) +#endif + +/***************************************************************************** + * IDirect3DRMFace interface + */ +#define INTERFACE IDirect3DRMFace +DECLARE_INTERFACE_(IDirect3DRMFace,IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMFace methods ***/ + STDMETHOD(AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddVertexAndNormalIndexed)(THIS_ DWORD vertex, DWORD normal) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ struct IDirect3DRMTexture *texture) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetMaterial)(THIS_ struct IDirect3DRMMaterial *material) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(GetVertex)(THIS_ DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal) PURE; + STDMETHOD(GetVertices)(THIS_ DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals); + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE *u, D3DVALUE *v) PURE; + STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE; + STDMETHOD(GetNormal)(THIS_ D3DVECTOR *) PURE; + STDMETHOD(GetTexture)(THIS_ struct IDirect3DRMTexture **texture) PURE; + STDMETHOD(GetMaterial)(THIS_ struct IDirect3DRMMaterial **material) PURE; + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(int, GetVertexIndex)(THIS_ DWORD which) PURE; + STDMETHOD_(int, GetTextureCoordinateIndex)(THIS_ DWORD which) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMFace_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMFace_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMFace_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMFace_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMFace_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMFace_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMFace_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMFace_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMFace_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMFace_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMFace_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMFace methods ***/ +#define IDirect3DRMFace_AddVertex(p,a,b,c) (p)->lpVtbl->AddVertex(p,a,b,c) +#define IDirect3DRMFace_AddVertexAndNormalIndexed(p,a,b) (p)->lpVtbl->AddVertexAndNormalIndexed(p,a,b) +#define IDirect3DRMFace_SetColorRGB(p,a,b,c) (p)->lpVtbl->SetColorRGB(p,a,b,c) +#define IDirect3DRMFace_SetColor(p,a) (p)->lpVtbl->SetColor(p,a) +#define IDirect3DRMFace_SetTexture(p,a) (p)->lpVtbl->SetTexture(p,a) +#define IDirect3DRMFace_SetTextureCoordinates(p,a,b,c) (p)->lpVtbl->SetTextureCoordinates(p,a,b,c) +#define IDirect3DRMFace_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DRMFace_SetTextureTopology(p,a,b) (p)->lpVtbl->SetTextureTopology(p,a,b) +#define IDirect3DRMFace_GetVertex(p,a,b,c) (p)->lpVtbl->GetVertex(p,a,b,c) +#define IDirect3DRMFace_GetVertices(p,a,b,c) (p)->lpVtbl->GetVertices(p,a,b,c) +#define IDirect3DRMFace_GetTextureCoordinates(p,a,b,c) (p)->lpVtbl->GetTextureCoordinates(p,a,b,c) +#define IDirect3DRMFace_GetTextureTopology(p,a,b) (p)->lpVtbl->GetTextureTopology(p,a,b) +#define IDirect3DRMFace_GetNormal(p,a) (p)->lpVtbl->GetNormal(p,a) +#define IDirect3DRMFace_GetTexture(p,a) (p)->lpVtbl->GetTexture(p,a) +#define IDirect3DRMFace_GetVertexCount(p) (p)->lpVtbl->GetVertexCount(p) +#define IDirect3DRMFace_GetVertexIndex(p,a) (p)->lpVtbl->GetVertexIndex(p,a) +#define IDirect3DRMFace_GetTextureCoordinateIndex(p,a) (p)->lpVtbl->GetTextureCoordinateIndex(p,a) +#define IDirect3DRMFace_GetColor(p) (p)->lpVtbl->GetColor(p) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMFace_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMFace_AddRef(p) (p)->AddRef() +#define IDirect3DRMFace_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMFace_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMFace_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMFace_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMFace_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMFace_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMFace_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMFace_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMFace_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMFace methods ***/ +#define IDirect3DRMFace_AddVertex(p,a,b,c) (p)->AddVertex(a,b,c) +#define IDirect3DRMFace_AddVertexAndNormalIndexed(p,a,b) (p)->AddVertexAndNormalIndexed(a,b) +#define IDirect3DRMFace_SetColorRGB(p,a,b,c) (p)->SetColorRGB(a,b,c) +#define IDirect3DRMFace_SetColor(p,a) (p)->SetColor(a) +#define IDirect3DRMFace_SetTexture(p,a) (p)->SetTexture(a) +#define IDirect3DRMFace_SetTextureCoordinates(p,a,b,c) (p)->SetTextureCoordinates(a,b,c) +#define IDirect3DRMFace_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DRMFace_SetTextureTopology(p,a,b) (p)->SetTextureTopology(a,b) +#define IDirect3DRMFace_GetVertex(p,a,b,c) (p)->GetVertex(a,b,c) +#define IDirect3DRMFace_GetVertices(p,a,b,c) (p)->GetVertices(a,b,c) +#define IDirect3DRMFace_GetTextureCoordinates(p,a,b,c) (p)->GetTextureCoordinates(a,b,c) +#define IDirect3DRMFace_GetTextureTopology(p,a,b) (p)->GetTextureTopology(a,b) +#define IDirect3DRMFace_GetNormal(p,a) (p)->GetNormal(a) +#define IDirect3DRMFace_GetTexture(p,a) (p)->GetTexture(a) +#define IDirect3DRMFace_GetVertexCount(p) (p)->GetVertexCount() +#define IDirect3DRMFace_GetVertexIndex(p,a) (p)->GetVertexIndex(a) +#define IDirect3DRMFace_GetTextureCoordinateIndex(p,a) (p)->GetTextureCoordinateIndex(a) +#define IDirect3DRMFace_GetColor(p) (p)->GetColor() +#endif + +/***************************************************************************** + * IDirect3DRMFace2 interface + */ +#define INTERFACE IDirect3DRMFace2 +DECLARE_INTERFACE_(IDirect3DRMFace2,IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMFace methods ***/ + STDMETHOD(AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddVertexAndNormalIndexed)(THIS_ DWORD vertex, DWORD normal) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ struct IDirect3DRMTexture3 *texture) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetMaterial)(THIS_ struct IDirect3DRMMaterial2 *material) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(GetVertex)(THIS_ DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal) PURE; + STDMETHOD(GetVertices)(THIS_ DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals); + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE *u, D3DVALUE *v) PURE; + STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE; + STDMETHOD(GetNormal)(THIS_ D3DVECTOR *) PURE; + STDMETHOD(GetTexture)(THIS_ struct IDirect3DRMTexture3 **texture) PURE; + STDMETHOD(GetMaterial)(THIS_ struct IDirect3DRMMaterial2 **material) PURE; + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(int, GetVertexIndex)(THIS_ DWORD which) PURE; + STDMETHOD_(int, GetTextureCoordinateIndex)(THIS_ DWORD which) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMFace2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMFace2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMFace2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMFace2_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMFace2_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMFace2_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMFace2_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMFace2_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMFace2_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMFace2_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMFace2_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMFace methods ***/ +#define IDirect3DRMFace2_AddVertex(p,a,b,c) (p)->lpVtbl->AddVertex(p,a,b,c) +#define IDirect3DRMFace2_AddVertexAndNormalIndexed(p,a,b) (p)->lpVtbl->AddVertexAndNormalIndexed(p,a,b) +#define IDirect3DRMFace2_SetColorRGB(p,a,b,c) (p)->lpVtbl->SetColorRGB(p,a,b,c) +#define IDirect3DRMFace2_SetColor(p,a) (p)->lpVtbl->SetColor(p,a) +#define IDirect3DRMFace2_SetTexture(p,a) (p)->lpVtbl->SetTexture(p,a) +#define IDirect3DRMFace2_SetTextureCoordinates(p,a,b,c) (p)->lpVtbl->SetTextureCoordinates(p,a,b,c) +#define IDirect3DRMFace2_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DRMFace2_SetTextureTopology(p,a,b) (p)->lpVtbl->SetTextureTopology(p,a,b) +#define IDirect3DRMFace2_GetVertex(p,a,b,c) (p)->lpVtbl->GetVertex(p,a,b,c) +#define IDirect3DRMFace2_GetVertices(p,a,b,c) (p)->lpVtbl->GetVertices(p,a,b,c) +#define IDirect3DRMFace2_GetTextureCoordinates(p,a,b,c) (p)->lpVtbl->GetTextureCoordinates(p,a,b,c) +#define IDirect3DRMFace2_GetTextureTopology(p,a,b) (p)->lpVtbl->GetTextureTopology(p,a,b) +#define IDirect3DRMFace2_GetNormal(p,a) (p)->lpVtbl->GetNormal(p,a) +#define IDirect3DRMFace2_GetTexture(p,a) (p)->lpVtbl->GetTexture(p,a) +#define IDirect3DRMFace2_GetVertexCount(p) (p)->lpVtbl->GetVertexCount(p) +#define IDirect3DRMFace2_GetVertexIndex(p,a) (p)->lpVtbl->GetVertexIndex(p,a) +#define IDirect3DRMFace2_GetTextureCoordinateIndex(p,a) (p)->lpVtbl->GetTextureCoordinateIndex(p,a) +#define IDirect3DRMFace2_GetColor(p) (p)->lpVtbl->GetColor(p) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMFace2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMFace2_AddRef(p) (p)->AddRef() +#define IDirect3DRMFace2_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMFace2_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMFace2_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMFace2_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMFace2_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMFace2_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMFace2_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMFace2_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMFace2_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMFace methods ***/ +#define IDirect3DRMFace2_AddVertex(p,a,b,c) (p)->AddVertex(a,b,c) +#define IDirect3DRMFace2_AddVertexAndNormalIndexed(p,a,b) (p)->AddVertexAndNormalIndexed(a,b) +#define IDirect3DRMFace2_SetColorRGB(p,a,b,c) (p)->SetColorRGB(a,b,c) +#define IDirect3DRMFace2_SetColor(p,a) (p)->SetColor(a) +#define IDirect3DRMFace2_SetTexture(p,a) (p)->SetTexture(a) +#define IDirect3DRMFace2_SetTextureCoordinates(p,a,b,c) (p)->SetTextureCoordinates(a,b,c) +#define IDirect3DRMFace2_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DRMFace2_SetTextureTopology(p,a,b) (p)->SetTextureTopology(a,b) +#define IDirect3DRMFace2_GetVertex(p,a,b,c) (p)->GetVertex(a,b,c) +#define IDirect3DRMFace2_GetVertices(p,a,b,c) (p)->GetVertices(a,b,c) +#define IDirect3DRMFace2_GetTextureCoordinates(p,a,b,c) (p)->GetTextureCoordinates(a,b,c) +#define IDirect3DRMFace2_GetTextureTopology(p,a,b) (p)->GetTextureTopology(a,b) +#define IDirect3DRMFace2_GetNormal(p,a) (p)->GetNormal(a) +#define IDirect3DRMFace2_GetTexture(p,a) (p)->GetTexture(a) +#define IDirect3DRMFace2_GetVertexCount(p) (p)->GetVertexCount() +#define IDirect3DRMFace2_GetVertexIndex(p,a) (p)->GetVertexIndex(a) +#define IDirect3DRMFace2_GetTextureCoordinateIndex(p,a) (p)->GetTextureCoordinateIndex(a) +#define IDirect3DRMFace2_GetColor(p) (p)->GetColor() +#endif + +/***************************************************************************** + * IDirect3DRMMeshBuilder interface + */ +#define INTERFACE IDirect3DRMMeshBuilder +DECLARE_INTERFACE_(IDirect3DRMMeshBuilder,IDirect3DRMVisual) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMMeshBuilder methods ***/ + STDMETHOD(Load)(THIS_ void *filename, void *name, D3DRMLOADOPTIONS flags, + D3DRMLOADTEXTURECALLBACK cb, void *ctx) PURE; + STDMETHOD(Save)(THIS_ const char *filename, D3DRMXOFFORMAT, D3DRMSAVEOPTIONS save) PURE; + STDMETHOD(Scale)(THIS_ D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(Translate)(THIS_ D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) PURE; + STDMETHOD(SetColorSource)(THIS_ D3DRMCOLORSOURCE) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *) PURE; + STDMETHOD(GenerateNormals)(THIS) PURE; + STDMETHOD_(D3DRMCOLORSOURCE, GetColorSource)(THIS) PURE; + STDMETHOD(AddMesh)(THIS_ IDirect3DRMMesh *mesh) PURE; + STDMETHOD(AddMeshBuilder)(THIS_ IDirect3DRMMeshBuilder *mesh_builder) PURE; + STDMETHOD(AddFrame)(THIS_ IDirect3DRMFrame *frame) PURE; + STDMETHOD(AddFace)(THIS_ IDirect3DRMFace *face) PURE; + STDMETHOD(AddFaces)(THIS_ DWORD vertex_count, D3DVECTOR *vertices, DWORD normal_count, + D3DVECTOR *normals, DWORD *face_data, struct IDirect3DRMFaceArray **array) PURE; + STDMETHOD(ReserveSpace)(THIS_ DWORD vertex_Count, DWORD normal_count, DWORD face_count) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ struct IDirect3DRMTexture *texture) PURE; + STDMETHOD(SetMaterial)(THIS_ struct IDirect3DRMMaterial *material) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetPerspective)(THIS_ BOOL) PURE; + STDMETHOD(SetVertex)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetNormal)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD index, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetVertexColor)(THIS_ DWORD index, D3DCOLOR) PURE; + STDMETHOD(SetVertexColorRGB)(THIS_ DWORD index, D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(GetFaces)(THIS_ struct IDirect3DRMFaceArray **array) PURE; + STDMETHOD(GetVertices)(THIS_ DWORD *vcount, D3DVECTOR *vertices, DWORD *ncount, D3DVECTOR *normals, + DWORD *face_data_size, DWORD *face_data) PURE; + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD index, D3DVALUE *u, D3DVALUE *v) PURE; + STDMETHOD_(int, AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD_(int, AddNormal)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(CreateFace)(THIS_ IDirect3DRMFace **face) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(BOOL, GetPerspective)(THIS) PURE; + STDMETHOD_(int, GetFaceCount)(THIS) PURE; + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetVertexColor)(THIS_ DWORD index) PURE; + STDMETHOD(CreateMesh)(THIS_ IDirect3DRMMesh **mesh) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMMeshBuilder_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMMeshBuilder_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMMeshBuilder_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMMeshBuilder_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMMeshBuilder_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMMeshBuilder_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMMeshBuilder_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMMeshBuilder_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMMeshBuilder_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMMeshBuilder_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMMeshBuilder_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMMeshBuilder methods ***/ +#define IDirect3DRMMeshBuilder_Load(p,a,b,c,d,e) (p)->lpVtbl->Load(p,a,b,c,d,e) +#define IDirect3DRMMeshBuilder_Save(p,a,b,c) (p)->lpVtbl->Save(p,a,b,c) +#define IDirect3DRMMeshBuilder_Scale(p,a,b,c) (p)->lpVtbl->Scale(p,a,b,c) +#define IDirect3DRMMeshBuilder_Translate(p,a,b,c) (p)->lpVtbl->Translate(p,a) +#define IDirect3DRMMeshBuilder_SetColorSource(p,a) (p)->lpVtbl->SetColorSource(p,a,b,c) +#define IDirect3DRMMeshBuilder_GetBox(p,a) (p)->lpVtbl->GetBox(p,a) +#define IDirect3DRMMeshBuilder_GenerateNormals(p) (p)->lpVtbl->GenerateNormals(p) +#define IDirect3DRMMeshBuilder_GetColorSource(p) (p)->lpVtbl->GetColorSource(p) +#define IDirect3DRMMeshBuilder_AddMesh(p,a) (p)->lpVtbl->AddMesh(p,a) +#define IDirect3DRMMeshBuilder_AddMeshBuilder(p,a) (p)->lpVtbl->AddMeshBuilder(p,a) +#define IDirect3DRMMeshBuilder_AddFrame(p,a) (p)->lpVtbl->AddFrame(p,a) +#define IDirect3DRMMeshBuilder_AddFace(p,a) (p)->lpVtbl->AddFace(p,a) +#define IDirect3DRMMeshBuilder_AddFaces(p,a,b,c,d,e,f) (p)->lpVtbl->AddFaces(p,a,b,c,d,e,f) +#define IDirect3DRMMeshBuilder_ReserveSpace(p,a,b,c) (p)->lpVtbl->ReserveSpace(p,a,b,c) +#define IDirect3DRMMeshBuilder_SetColorRGB(p,a,b,c) (p)->lpVtbl->SetColorRGB(p,a,b,c) +#define IDirect3DRMMeshBuilder_SetColor(p,a) (p)->lpVtbl->SetColor(p,a) +#define IDirect3DRMMeshBuilder_SetTexture(p,a) (p)->lpVtbl->SetTexture(p,a) +#define IDirect3DRMMeshBuilder_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DRMMeshBuilder_SetTextureTopology(p,a,b) (p)->lpVtbl->SetTextureTopology(p,a,b) +#define IDirect3DRMMeshBuilder_SetQuality(p,a) (p)->lpVtbl->SetQuality(p,a) +#define IDirect3DRMMeshBuilder_SetPerspective(p,a) (p)->lpVtbl->SetPerspective(p,a) +#define IDirect3DRMMeshBuilder_SetVertex(p,a,b,c,d) (p)->lpVtbl->SetVertex(p,a,b,c,d) +#define IDirect3DRMMeshBuilder_SetNormal(p,a,b,c,d) (p)->lpVtbl->SetNormal(p,a,b,c,d) +#define IDirect3DRMMeshBuilder_SetTextureCoordinates(p,a,b,c) (p)->lpVtbl->SetTextureCoordinates(p,a,b,c) +#define IDirect3DRMMeshBuilder_SetVertexColor(p,a,b) (p)->lpVtbl->SetVertexColor(p,a,b) +#define IDirect3DRMMeshBuilder_SetVertexColorRGB(p,a,b,c,d) (p)->lpVtbl->SetVertexColorRGB(p,a,b,c,d) +#define IDirect3DRMMeshBuilder_GetFaces(p,a) (p)->lpVtbl->GetFaces(p,a) +#define IDirect3DRMMeshBuilder_GetVertices(p,a,b,c,d,e,f) (p)->lpVtbl->GetVertices(p,a,b,c,d,e,f) +#define IDirect3DRMMeshBuilder_GetTextureCoordinates(p,a,b,c) (p)->lpVtbl->GetTextureCoordinates(p,a,b,c) +#define IDirect3DRMMeshBuilder_AddVertex(p,a,b,c) (p)->lpVtbl->AddVertex(p,a,b,c) +#define IDirect3DRMMeshBuilder_AddNormal(p,a,b,c) (p)->lpVtbl->AddNormal(p,a,b,c) +#define IDirect3DRMMeshBuilder_CreateFace(p,a) (p)->lpVtbl->CreateFace(p,a) +#define IDirect3DRMMeshBuilder_GetQuality(p) (p)->lpVtbl->GetQuality(p) +#define IDirect3DRMMeshBuilder_GetPerspective(p) (p)->lpVtbl->GetPerspective(p) +#define IDirect3DRMMeshBuilder_GetFaceCount(p) (p)->lpVtbl->GetFaceCount(p) +#define IDirect3DRMMeshBuilder_GetVertexCount(p) (p)->lpVtbl->GetVertexCount(p) +#define IDirect3DRMMeshBuilder_GetVertexColor(p,a) (p)->lpVtbl->GetVertexColor(p,a) +#define IDirect3DRMMeshBuilder_CreateMesh(p,a) (p)->lpVtbl->CreateMesh(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMMeshBuilder_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMMeshBuilder_AddRef(p) (p)->AddRef() +#define IDirect3DRMMeshBuilder_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMMeshBuilder_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMMeshBuilder_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMMeshBuilder_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMMeshBuilder_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMMeshBuilder_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMMeshBuilder_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMMeshBuilder_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMMeshBuilder_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMMeshBuilder methods ***/ +#define IDirect3DRMMeshBuilder_Load(p,a,b,c,d,e) (p)->Load(a,b,c,d,e) +#define IDirect3DRMMeshBuilder_Save(p,a,b,c) (p)->Save(a,b,c) +#define IDirect3DRMMeshBuilder_Scale(p,a,b,c) (p)->Scale(a,b,c) +#define IDirect3DRMMeshBuilder_Translate(p,a,b,c) (p)->Translate(a) +#define IDirect3DRMMeshBuilder_SetColorSource(p,a) (p)->SetColorSource(a,b,c) +#define IDirect3DRMMeshBuilder_GetBox(p,a) (p)->GetBox(a) +#define IDirect3DRMMeshBuilder_GenerateNormals(p) (p)->GenerateNormals() +#define IDirect3DRMMeshBuilder_GetColorSource(p) (p)->GetColorSource() +#define IDirect3DRMMeshBuilder_AddMesh(p,a) (p)-->AddMesh(a) +#define IDirect3DRMMeshBuilder_AddMeshBuilder(p,a) (p)->AddMeshBuilder(a) +#define IDirect3DRMMeshBuilder_AddFrame(p,a) (p)->AddFrame(a) +#define IDirect3DRMMeshBuilder_AddFace(p,a) (p)->AddFace(a) +#define IDirect3DRMMeshBuilder_AddFaces(p,a,b,c,d,e,f) (p)->AddFaces(a,b,c,d,e,f) +#define IDirect3DRMMeshBuilder_ReserveSpace(p,a,b,c) (p)->ReserveSpace(a,b,c) +#define IDirect3DRMMeshBuilder_SetColorRGB(p,a,b,c) (p)->SetColorRGB(a,b,c) +#define IDirect3DRMMeshBuilder_SetColor(p,a) (p)->SetColor(a) +#define IDirect3DRMMeshBuilder_SetTexture(p,a) (p)->SetTexture(a) +#define IDirect3DRMMeshBuilder_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DRMMeshBuilder_SetTextureTopology(p,a,b) (p)->SetTextureTopology(a,b) +#define IDirect3DRMMeshBuilder_SetQuality(p,a) (p)->SetQuality(a) +#define IDirect3DRMMeshBuilder_SetPerspective(p,a) (p)->SetPerspective(a) +#define IDirect3DRMMeshBuilder_SetVertex(p,a,b,c,d) (p)->SetVertex(a,b,c,d) +#define IDirect3DRMMeshBuilder_SetNormal(p,a,b,c,d) (p)->SetNormal(a,b,c,d) +#define IDirect3DRMMeshBuilder_SetTextureCoordinates(p,a,b,c) (p)->SetTextureCoordinates(a,b,c) +#define IDirect3DRMMeshBuilder_SetVertexColor(p,a,b) (p)->SetVertexColor(a,b) +#define IDirect3DRMMeshBuilder_SetVertexColorRGB(p,a,b,c,d) (p)->SetVertexColorRGB(a,b,c,d) +#define IDirect3DRMMeshBuilder_GetFaces(p,a) (p)->GetFaces(a) +#define IDirect3DRMMeshBuilder_GetVertices(p,a,b,c,d,e,f) (p)->GetVertices(a,b,c,d,e,f) +#define IDirect3DRMMeshBuilder_GetTextureCoordinates(p,a,b,c) (p)->GetTextureCoordinates(a,b,c) +#define IDirect3DRMMeshBuilder_AddVertex(p,a,b,c) (p)->AddVertex(a,b,c) +#define IDirect3DRMMeshBuilder_AddNormal(p,a,b,c) (p)->AddNormal(a,b,c) +#define IDirect3DRMMeshBuilder_CreateFace(p,a) (p)->CreateFace(a) +#define IDirect3DRMMeshBuilder_GetQuality(p) (p)->GetQuality() +#define IDirect3DRMMeshBuilder_GetPerspective(p) (p)->GetPerspective() +#define IDirect3DRMMeshBuilder_GetFaceCount(p) (p)->GetFaceCount() +#define IDirect3DRMMeshBuilder_GetVertexCount(p) (p)->GetVertexCount() +#define IDirect3DRMMeshBuilder_GetVertexColor(p,a) (p)->GetVertexColor(a) +#define IDirect3DRMMeshBuilder_CreateMesh(p,a) (p)->CreateMesh(a) +#endif + +/***************************************************************************** + * IDirect3DRMMeshBuilder2 interface + */ +#define INTERFACE IDirect3DRMMeshBuilder2 +DECLARE_INTERFACE_(IDirect3DRMMeshBuilder2,IDirect3DRMMeshBuilder) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMMeshBuilder methods ***/ + STDMETHOD(Load)(THIS_ void *filename, void *name, D3DRMLOADOPTIONS flags, + D3DRMLOADTEXTURECALLBACK cb, void *ctx) PURE; + STDMETHOD(Save)(THIS_ const char *filename, D3DRMXOFFORMAT, D3DRMSAVEOPTIONS save) PURE; + STDMETHOD(Scale)(THIS_ D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(Translate)(THIS_ D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) PURE; + STDMETHOD(SetColorSource)(THIS_ D3DRMCOLORSOURCE) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *) PURE; + STDMETHOD(GenerateNormals)(THIS) PURE; + STDMETHOD_(D3DRMCOLORSOURCE, GetColorSource)(THIS) PURE; + STDMETHOD(AddMesh)(THIS_ IDirect3DRMMesh *mesh) PURE; + STDMETHOD(AddMeshBuilder)(THIS_ IDirect3DRMMeshBuilder *mesh_builder) PURE; + STDMETHOD(AddFrame)(THIS_ IDirect3DRMFrame *frame) PURE; + STDMETHOD(AddFace)(THIS_ IDirect3DRMFace *face) PURE; + STDMETHOD(AddFaces)(THIS_ DWORD vertex_count, D3DVECTOR *vertices, DWORD normal_count, + D3DVECTOR *normals, DWORD *face_data, struct IDirect3DRMFaceArray **array) PURE; + STDMETHOD(ReserveSpace)(THIS_ DWORD vertex_Count, DWORD normal_count, DWORD face_count) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ struct IDirect3DRMTexture *texture) PURE; + STDMETHOD(SetMaterial)(THIS_ struct IDirect3DRMMaterial *material) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetPerspective)(THIS_ BOOL) PURE; + STDMETHOD(SetVertex)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetNormal)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD index, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetVertexColor)(THIS_ DWORD index, D3DCOLOR) PURE; + STDMETHOD(SetVertexColorRGB)(THIS_ DWORD index, D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(GetFaces)(THIS_ struct IDirect3DRMFaceArray **array) PURE; + STDMETHOD(GetVertices)(THIS_ DWORD *vcount, D3DVECTOR *vertices, DWORD *ncount, D3DVECTOR *normals, + DWORD *face_data_size, DWORD *face_data) PURE; + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD index, D3DVALUE *u, D3DVALUE *v) PURE; + STDMETHOD_(int, AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD_(int, AddNormal)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(CreateFace)(THIS_ IDirect3DRMFace **face) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(BOOL, GetPerspective)(THIS) PURE; + STDMETHOD_(int, GetFaceCount)(THIS) PURE; + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetVertexColor)(THIS_ DWORD index) PURE; + STDMETHOD(CreateMesh)(THIS_ IDirect3DRMMesh **mesh) PURE; + /*** IDirect3DRMMeshBuilder2 methods ***/ + STDMETHOD(GenerateNormals2)(THIS_ D3DVALUE crease, DWORD flags) PURE; + STDMETHOD(GetFace)(THIS_ DWORD index, IDirect3DRMFace **face) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMMeshBuilder2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMMeshBuilder2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMMeshBuilder2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMMeshBuilder2_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMMeshBuilder2_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMMeshBuilder2_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMMeshBuilder2_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMMeshBuilder2_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMMeshBuilder2_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMMeshBuilder2_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMMeshBuilder2_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMMeshBuilder methods ***/ +#define IDirect3DRMMeshBuilder2_Load(p,a,b,c,d,e) (p)->lpVtbl->Load(p,a,b,c,d,e) +#define IDirect3DRMMeshBuilder2_Save(p,a,b,c) (p)->lpVtbl->Save(p,a,b,c) +#define IDirect3DRMMeshBuilder2_Scale(p,a,b,c) (p)->lpVtbl->Scale(p,a,b,c) +#define IDirect3DRMMeshBuilder2_Translate(p,a,b,c) (p)->lpVtbl->Translate(p,a) +#define IDirect3DRMMeshBuilder2_SetColorSource(p,a) (p)->lpVtbl->SetColorSource(p,a,b,c) +#define IDirect3DRMMeshBuilder2_GetBox(p,a) (p)->lpVtbl->GetBox(p,a) +#define IDirect3DRMMeshBuilder2_GenerateNormals(p) (p)->lpVtbl->GenerateNormals(p) +#define IDirect3DRMMeshBuilder2_GetColorSource(p) (p)->lpVtbl->GetColorSource(p) +#define IDirect3DRMMeshBuilder2_AddMesh(p,a) (p)->lpVtbl->AddMesh(p,a) +#define IDirect3DRMMeshBuilder2_AddMeshBuilder(p,a) (p)->lpVtbl->AddMeshBuilder(p,a) +#define IDirect3DRMMeshBuilder2_AddFrame(p,a) (p)->lpVtbl->AddFrame(p,a) +#define IDirect3DRMMeshBuilder2_AddFace(p,a) (p)->lpVtbl->AddFace(p,a) +#define IDirect3DRMMeshBuilder2_AddFaces(p,a,b,c,d,e,f) (p)->lpVtbl->AddFaces(p,a,b,c,d,e,f) +#define IDirect3DRMMeshBuilder2_ReserveSpace(p,a,b,c) (p)->lpVtbl->ReserveSpace(p,a,b,c) +#define IDirect3DRMMeshBuilder2_SetColorRGB(p,a,b,c) (p)->lpVtbl->SetColorRGB(p,a,b,c) +#define IDirect3DRMMeshBuilder2_SetColor(p,a) (p)->lpVtbl->SetColor(p,a) +#define IDirect3DRMMeshBuilder2_SetTexture(p,a) (p)->lpVtbl->SetTexture(p,a) +#define IDirect3DRMMeshBuilder2_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DRMMeshBuilder2_SetTextureTopology(p,a,b) (p)->lpVtbl->SetTextureTopology(p,a,b) +#define IDirect3DRMMeshBuilder2_SetQuality(p,a) (p)->lpVtbl->SetQuality(p,a) +#define IDirect3DRMMeshBuilder2_SetPerspective(p,a) (p)->lpVtbl->SetPerspective(p,a) +#define IDirect3DRMMeshBuilder2_SetVertex(p,a,b,c,d) (p)->lpVtbl->SetVertex(p,a,b,c,d) +#define IDirect3DRMMeshBuilder2_SetNormal(p,a,b,c,d) (p)->lpVtbl->SetNormal(p,a,b,c,d) +#define IDirect3DRMMeshBuilder2_SetTextureCoordinates(p,a,b,c) (p)->lpVtbl->SetTextureCoordinates(p,a,b,c) +#define IDirect3DRMMeshBuilder2_SetVertexColor(p,a,b) (p)->lpVtbl->SetVertexColor(p,a,b) +#define IDirect3DRMMeshBuilder2_SetVertexColorRGB(p,a,b,c,d) (p)->lpVtbl->SetVertexColorRGB(p,a,b,c,d) +#define IDirect3DRMMeshBuilder2_GetFaces(p,a) (p)->lpVtbl->GetFaces(p,a) +#define IDirect3DRMMeshBuilder2_GetVertices(p,a,b,c,d,e,f) (p)->lpVtbl->GetVertices(p,a,b,c,d,e,f) +#define IDirect3DRMMeshBuilder2_GetTextureCoordinates(p,a,b,c) (p)->lpVtbl->GetTextureCoordinates(p,a,b,c) +#define IDirect3DRMMeshBuilder2_AddVertex(p,a,b,c) (p)->lpVtbl->AddVertex(p,a,b,c) +#define IDirect3DRMMeshBuilder2_AddNormal(p,a,b,c) (p)->lpVtbl->AddNormal(p,a,b,c) +#define IDirect3DRMMeshBuilder2_CreateFace(p,a) (p)->lpVtbl->CreateFace(p,a) +#define IDirect3DRMMeshBuilder2_GetQuality(p) (p)->lpVtbl->GetQuality(p) +#define IDirect3DRMMeshBuilder2_GetPerspective(p) (p)->lpVtbl->GetPerspective(p) +#define IDirect3DRMMeshBuilder2_GetFaceCount(p) (p)->lpVtbl->GetFaceCount(p) +#define IDirect3DRMMeshBuilder2_GetVertexCount(p) (p)->lpVtbl->GetVertexCount(p) +#define IDirect3DRMMeshBuilder2_GetVertexColor(p,a) (p)->lpVtbl->GetVertexColor(p,a) +#define IDirect3DRMMeshBuilder2_CreateMesh(p,a) (p)->lpVtbl->CreateMesh(p,a) +/*** IDirect3DRMMeshBuilder2 methods ***/ +#define IDirect3DRMMeshBuilder2_GenerateNormals2(p,a,b) (p)->lpVtbl->GenerateNormals2(p,a,b) +#define IDirect3DRMMeshBuilder2_GetFace(p,a,b) (p)->lpVtbl->GetFace(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMMeshBuilder2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMMeshBuilder2_AddRef(p) (p)->AddRef() +#define IDirect3DRMMeshBuilder2_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMMeshBuilder2_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMMeshBuilder2_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMMeshBuilder2_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMMeshBuilder2_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMMeshBuilder2_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMMeshBuilder2_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMMeshBuilder2_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMMeshBuilder2_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMMeshBuilder methods ***/ +#define IDirect3DRMMeshBuilder2_Load(p,a,b,c,d,e) (p)->Load(a,b,c,d,e) +#define IDirect3DRMMeshBuilder2_Save(p,a,b,c) (p)->Save(a,b,c) +#define IDirect3DRMMeshBuilder2_Scale(p,a,b,c) (p)->Scale(a,b,c) +#define IDirect3DRMMeshBuilder2_Translate(p,a,b,c) (p)->Translate(a) +#define IDirect3DRMMeshBuilder2_SetColorSource(p,a) (p)->SetColorSource(a,b,c) +#define IDirect3DRMMeshBuilder2_GetBox(p,a) (p)->GetBox(a) +#define IDirect3DRMMeshBuilder2_GenerateNormals(p) (p)->GenerateNormals() +#define IDirect3DRMMeshBuilder2_GetColorSource(p) (p)->GetColorSource() +#define IDirect3DRMMeshBuilder2_AddMesh(p,a) (p)-->AddMesh(a) +#define IDirect3DRMMeshBuilder2_AddMeshBuilder(p,a) (p)->AddMeshBuilder(a) +#define IDirect3DRMMeshBuilder2_AddFrame(p,a) (p)->AddFrame(a) +#define IDirect3DRMMeshBuilder2_AddFace(p,a) (p)->AddFace(a) +#define IDirect3DRMMeshBuilder2_AddFaces(p,a,b,c,d,e,f) (p)->AddFaces(a,b,c,d,e,f) +#define IDirect3DRMMeshBuilder2_ReserveSpace(p,a,b,c) (p)->ReserveSpace(a,b,c) +#define IDirect3DRMMeshBuilder2_SetColorRGB(p,a,b,c) (p)->SetColorRGB(a,b,c) +#define IDirect3DRMMeshBuilder2_SetColor(p,a) (p)->SetColor(a) +#define IDirect3DRMMeshBuilder2_SetTexture(p,a) (p)->SetTexture(a) +#define IDirect3DRMMeshBuilder2_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DRMMeshBuilder2_SetTextureTopology(p,a,b) (p)->SetTextureTopology(a,b) +#define IDirect3DRMMeshBuilder2_SetQuality(p,a) (p)->SetQuality(a) +#define IDirect3DRMMeshBuilder2_SetPerspective(p,a) (p)->SetPerspective(a) +#define IDirect3DRMMeshBuilder2_SetVertex(p,a,b,c,d) (p)->SetVertex(a,b,c,d) +#define IDirect3DRMMeshBuilder2_SetNormal(p,a,b,c,d) (p)->SetNormal(a,b,c,d) +#define IDirect3DRMMeshBuilder2_SetTextureCoordinates(p,a,b,c) (p)->SetTextureCoordinates(a,b,c) +#define IDirect3DRMMeshBuilder2_SetVertexColor(p,a,b) (p)->SetVertexColor(a,b) +#define IDirect3DRMMeshBuilder2_SetVertexColorRGB(p,a,b,c,d) (p)->SetVertexColorRGB(a,b,c,d) +#define IDirect3DRMMeshBuilder2_GetFaces(p,a) (p)->GetFaces(a) +#define IDirect3DRMMeshBuilder2_GetVertices(p,a,b,c,d,e,f) (p)->GetVertices(a,b,c,d,e,f) +#define IDirect3DRMMeshBuilder2_GetTextureCoordinates(p,a,b,c) (p)->GetTextureCoordinates(a,b,c) +#define IDirect3DRMMeshBuilder2_AddVertex(p,a,b,c) (p)->AddVertex(a,b,c) +#define IDirect3DRMMeshBuilder2_AddNormal(p,a,b,c) (p)->AddNormal(a,b,c) +#define IDirect3DRMMeshBuilder2_CreateFace(p,a) (p)->CreateFace(a) +#define IDirect3DRMMeshBuilder2_GetQuality(p) (p)->GetQuality() +#define IDirect3DRMMeshBuilder2_GetPerspective(p) (p)->GetPerspective() +#define IDirect3DRMMeshBuilder2_GetFaceCount(p) (p)->GetFaceCount() +#define IDirect3DRMMeshBuilder2_GetVertexCount(p) (p)->GetVertexCount() +#define IDirect3DRMMeshBuilder2_GetVertexColor(p,a) (p)->GetVertexColor(a) +#define IDirect3DRMMeshBuilder2_CreateMesh(p,a) (p)->CreateMesh(a) +/*** IDirect3DRMMeshBuilder2 methods ***/ +#define IDirect3DRMMeshBuilder2_GenerateNormals2(p,a,b) (p)->GenerateNormals2(a,b) +#define IDirect3DRMMeshBuilder2_GetFace(p,a,b) (p)->GetFace(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMMeshBuilder3 interface + */ +#define INTERFACE IDirect3DRMMeshBuilder3 +DECLARE_INTERFACE_(IDirect3DRMMeshBuilder3,IDirect3DRMVisual) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMMeshBuilder3 methods ***/ + STDMETHOD(Load)(THIS_ void *filename, void *name, D3DRMLOADOPTIONS flags, + D3DRMLOADTEXTURE3CALLBACK cb, void *ctx) PURE; + STDMETHOD(Save)(THIS_ const char *filename, D3DRMXOFFORMAT, D3DRMSAVEOPTIONS save) PURE; + STDMETHOD(Scale)(THIS_ D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(Translate)(THIS_ D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) PURE; + STDMETHOD(SetColorSource)(THIS_ D3DRMCOLORSOURCE) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *) PURE; + STDMETHOD(GenerateNormals)(THIS_ D3DVALUE crease, DWORD flags) PURE; + STDMETHOD_(D3DRMCOLORSOURCE, GetColorSource)(THIS) PURE; + STDMETHOD(AddMesh)(THIS_ IDirect3DRMMesh *mesh) PURE; + STDMETHOD(AddMeshBuilder)(THIS_ IDirect3DRMMeshBuilder3 *mesh_builder, DWORD flags) PURE; + STDMETHOD(AddFrame)(THIS_ IDirect3DRMFrame3 *frame) PURE; + STDMETHOD(AddFace)(THIS_ IDirect3DRMFace2 *face) PURE; + STDMETHOD(AddFaces)(THIS_ DWORD vertex_count, D3DVECTOR *vertices, DWORD normal_count, + D3DVECTOR *normals, DWORD *face_data, struct IDirect3DRMFaceArray **array) PURE; + STDMETHOD(ReserveSpace)(THIS_ DWORD vertex_Count, DWORD normal_count, DWORD face_count) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ struct IDirect3DRMTexture3 *texture) PURE; + STDMETHOD(SetMaterial)(THIS_ struct IDirect3DRMMaterial2 *material) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetPerspective)(THIS_ BOOL) PURE; + STDMETHOD(SetVertex)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetNormal)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD index, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetVertexColor)(THIS_ DWORD index, D3DCOLOR) PURE; + STDMETHOD(SetVertexColorRGB)(THIS_ DWORD index, D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(GetFaces)(THIS_ struct IDirect3DRMFaceArray **array) PURE; + STDMETHOD(GetGeometry)(THIS_ DWORD *vcount, D3DVECTOR *vertices, DWORD *ncount, D3DVECTOR *normals, + DWORD *face_data_size, DWORD *face_data) PURE; + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD index, D3DVALUE *u, D3DVALUE *v) PURE; + STDMETHOD_(int, AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD_(int, AddNormal)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(CreateFace)(THIS_ IDirect3DRMFace2 **face) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(BOOL, GetPerspective)(THIS) PURE; + STDMETHOD_(int, GetFaceCount)(THIS) PURE; + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetVertexColor)(THIS_ DWORD index) PURE; + STDMETHOD(CreateMesh)(THIS_ IDirect3DRMMesh **mesh) PURE; + STDMETHOD(GetFace)(THIS_ DWORD index, IDirect3DRMFace2 **face) PURE; + STDMETHOD(GetVertex)(THIS_ DWORD index, D3DVECTOR *vector) PURE; + STDMETHOD(GetNormal)(THIS_ DWORD index, D3DVECTOR *vector) PURE; + STDMETHOD(DeleteVertices)(THIS_ DWORD IndexFirst, DWORD count) PURE; + STDMETHOD(DeleteNormals)(THIS_ DWORD IndexFirst, DWORD count) PURE; + STDMETHOD(DeleteFace)(THIS_ IDirect3DRMFace2 *face) PURE; + STDMETHOD(Empty)(THIS_ DWORD flags) PURE; + STDMETHOD(Optimize)(THIS_ DWORD flags) PURE; + STDMETHOD(AddFacesIndexed)(THIS_ DWORD flags, DWORD *pvIndices, DWORD *pIndexFirst, DWORD *pCount) PURE; + STDMETHOD(CreateSubMesh)(THIS_ IUnknown **mesh) PURE; + STDMETHOD(GetParentMesh)(THIS_ DWORD flags, IUnknown **parent) PURE; + STDMETHOD(GetSubMeshes)(THIS_ DWORD *count, IUnknown **meshes) PURE; + STDMETHOD(DeleteSubMesh)(THIS_ IUnknown *mesh) PURE; + STDMETHOD(Enable)(THIS_ DWORD) PURE; + STDMETHOD(GetEnable)(THIS_ DWORD *) PURE; + STDMETHOD(AddTriangles)(THIS_ DWORD flags, DWORD format, DWORD vertex_count, void *data) PURE; + STDMETHOD(SetVertices)(THIS_ DWORD start_idx, DWORD count, D3DVECTOR *v) PURE; + STDMETHOD(GetVertices)(THIS_ DWORD start_idx, DWORD *count, D3DVECTOR *v) PURE; + STDMETHOD(SetNormals)(THIS_ DWORD start_idx, DWORD count, D3DVECTOR *v) PURE; + STDMETHOD(GetNormals)(THIS_ DWORD start_idx, DWORD *count, D3DVECTOR *v) PURE; + STDMETHOD_(int, GetNormalCount)(THIS) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMMeshBuilder3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMMeshBuilder3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMMeshBuilder3_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMMeshBuilder3_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMMeshBuilder3_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMMeshBuilder3_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMMeshBuilder3_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMMeshBuilder3_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMMeshBuilder3_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMMeshBuilder3_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMMeshBuilder3_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) + +/*** IDirect3DRMMeshBuilder3 methods ***/ +#define IDirect3DRMMeshBuilder3_Load(p,a,b,c,d,e) (p)->lpVtbl->Load(p,a,b,c,d,e) +#define IDirect3DRMMeshBuilder3_Save(p,a,b,c) (p)->lpVtbl->Save(p,a,b,c) +#define IDirect3DRMMeshBuilder3_Scale(p,a,b,c) (p)->lpVtbl->Scale(p,a,b,c) +#define IDirect3DRMMeshBuilder3_Translate(p,a,b,c) (p)->lpVtbl->Translate(p,a) +#define IDirect3DRMMeshBuilder3_SetColorSource(p,a) (p)->lpVtbl->SetColorSource(p,a,b,c) +#define IDirect3DRMMeshBuilder3_GetBox(p,a) (p)->lpVtbl->GetBox(p,a) +#define IDirect3DRMMeshBuilder3_GenerateNormals(p,a,b) (p)->lpVtbl->GenerateNormals(p,a,b) +#define IDirect3DRMMeshBuilder3_GetColorSource(p) (p)->lpVtbl->GetColorSource(p) +#define IDirect3DRMMeshBuilder3_AddMesh(p,a) (p)->lpVtbl->AddMesh(p,a) +#define IDirect3DRMMeshBuilder3_AddMeshBuilder(p,a) (p)->lpVtbl->AddMeshBuilder(p,a) +#define IDirect3DRMMeshBuilder3_AddFrame(p,a) (p)->lpVtbl->AddFrame(p,a) +#define IDirect3DRMMeshBuilder3_AddFace(p,a) (p)->lpVtbl->AddFace(p,a) +#define IDirect3DRMMeshBuilder3_AddFaces(p,a,b,c,d,e,f) (p)->lpVtbl->AddFaces(p,a,b,c,d,e,f) +#define IDirect3DRMMeshBuilder3_ReserveSpace(p,a,b,c) (p)->lpVtbl->ReserveSpace(p,a,b,c) +#define IDirect3DRMMeshBuilder3_SetColorRGB(p,a,b,c) (p)->lpVtbl->SetColorRGB(p,a,b,c) +#define IDirect3DRMMeshBuilder3_SetColor(p,a) (p)->lpVtbl->SetColor(p,a) +#define IDirect3DRMMeshBuilder3_SetTexture(p,a) (p)->lpVtbl->SetTexture(p,a) +#define IDirect3DRMMeshBuilder3_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DRMMeshBuilder3_SetTextureTopology(p,a,b) (p)->lpVtbl->SetTextureTopology(p,a,b) +#define IDirect3DRMMeshBuilder3_SetQuality(p,a) (p)->lpVtbl->SetQuality(p,a) +#define IDirect3DRMMeshBuilder3_SetPerspective(p,a) (p)->lpVtbl->SetPerspective(p,a) +#define IDirect3DRMMeshBuilder3_SetVertex(p,a,b,c,d) (p)->lpVtbl->SetVertex(p,a,b,c,d) +#define IDirect3DRMMeshBuilder3_SetNormal(p,a,b,c,d) (p)->lpVtbl->SetNormal(p,a,b,c,d) +#define IDirect3DRMMeshBuilder3_SetTextureCoordinates(p,a,b,c) (p)->lpVtbl->SetTextureCoordinates(p,a,b,c) +#define IDirect3DRMMeshBuilder3_SetVertexColor(p,a,b) (p)->lpVtbl->SetVertexColor(p,a,b) +#define IDirect3DRMMeshBuilder3_SetVertexColorRGB(p,a,b,c,d) (p)->lpVtbl->SetVertexColorRGB(p,a,b,c,d) +#define IDirect3DRMMeshBuilder3_GetFaces(p,a) (p)->lpVtbl->GetFaces(p,a) +#define IDirect3DRMMeshBuilder3_GetGeometry(p,a,b,c,d,e,f) (p)->lpVtbl->GetGeometry(p,a,b,c,d,e,f) +#define IDirect3DRMMeshBuilder3_GetTextureCoordinates(p,a,b,c) (p)->lpVtbl->GetTextureCoordinates(p,a,b,c) +#define IDirect3DRMMeshBuilder3_AddVertex(p,a,b,c) (p)->lpVtbl->AddVertex(p,a,b,c) +#define IDirect3DRMMeshBuilder3_AddNormal(p,a,b,c) (p)->lpVtbl->AddNormal(p,a,b,c) + +#define IDirect3DRMMeshBuilder3_CreateFace(p,a) (p)->lpVtbl->CreateFace(p,a) +#define IDirect3DRMMeshBuilder3_GetQuality(p) (p)->lpVtbl->GetQuality(p) +#define IDirect3DRMMeshBuilder3_GetPerspective(p) (p)->lpVtbl->GetPerspective(p) + +#define IDirect3DRMMeshBuilder3_GetFaceCount(p) (p)->lpVtbl->GetFaceCount(p) +#define IDirect3DRMMeshBuilder3_GetVertexCount(p) (p)->lpVtbl->GetVertexCount(p) +#define IDirect3DRMMeshBuilder3_GetVertexColor(p,a) (p)->lpVtbl->GetVertexColor(p,a) +#define IDirect3DRMMeshBuilder3_CreateMesh(p,a) (p)->lpVtbl->CreateMesh(p,a) +#define IDirect3DRMMeshBuilder3_GetFace(p,a,b) (p)->lpVtbl->GetFace(p,a,b) +#define IDirect3DRMMeshBuilder3_GetVertex(p,a,b) (p)->lpVtbl->GetVertex(p,a,b) +#define IDirect3DRMMeshBuilder3_GetNormal(p,a,b) (p)->lpVtbl->GetNormal(p,a,b) +#define IDirect3DRMMeshBuilder3_DeleteVertices(p,a,b) (p)->lpVtbl->DeleteVertices(p,a,b) +#define IDirect3DRMMeshBuilder3_DeleteNormals(p,a,b) (p)->lpVtbl->DeleteNormals(p,a,b) +#define IDirect3DRMMeshBuilder3_DeleteFace(p,a) (p)->lpVtbl->DeleteFace(p,a) +#define IDirect3DRMMeshBuilder3_Empty(p,a) (p)->lpVtbl->Empty(p,a) +#define IDirect3DRMMeshBuilder3_Optimize(p,a) (p)->lpVtbl->Optimize(p,a) +#define IDirect3DRMMeshBuilder3_AddFacesIndexed(p,a,b,c,d) (p)->lpVtbl->AddFacesIndexed(p,a,b,c,d) +#define IDirect3DRMMeshBuilder3_CreateSubMesh(p,a) (p)->lpVtbl->CreateSubMesh(p,a) +#define IDirect3DRMMeshBuilder3_GetParentMesh(p,a,b) (p)->lpVtbl->GetParentMesh(p,a,b) +#define IDirect3DRMMeshBuilder3_GetSubMeshes(p,a,b) (p)->lpVtbl->GetSubMeshes(p,a,b) +#define IDirect3DRMMeshBuilder3_DeleteSubMesh(p,a) (p)->lpVtbl->DeleteSubMesh(p,a) +#define IDirect3DRMMeshBuilder3_Enable(p,a) (p)->lpVtbl->Enable(p,a) +#define IDirect3DRMMeshBuilder3_AddTriangles(p,a,b,c,d) (p)->lpVtbl->AddTriangles(p,a,b,c,d) +#define IDirect3DRMMeshBuilder3_SetVertices(p,a,b,c) (p)->lpVtbl->SetVertices(p,a,b,c) +#define IDirect3DRMMeshBuilder3_GetVertices(p,a,b,c) (p)->lpVtbl->GetVertices(p,a,b,c) +#define IDirect3DRMMeshBuilder3_SetNormals(p,a,b,c) (p)->lpVtbl->SetNormals(p,a,b,c) +#define IDirect3DRMMeshBuilder3_GetNormals(p,a,b,c) (p)->lpVtbl->GetNormals(p,a,b,c) +#define IDirect3DRMMeshBuilder3_GetNormalCount(p) (p)->lpVtbl->GetNormalCount(p) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMMeshBuilder3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMMeshBuilder3_AddRef(p) (p)->AddRef() +#define IDirect3DRMMeshBuilder3_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMMeshBuilder3_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMMeshBuilder3_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMMeshBuilder3_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMMeshBuilder3_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMMeshBuilder3_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMMeshBuilder3_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMMeshBuilder3_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMMeshBuilder3_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMMeshBuilder3 methods ***/ +#define IDirect3DRMMeshBuilder3_Load(p,a,b,c,d,e) (p)->Load(a,b,c,d,e) +#define IDirect3DRMMeshBuilder3_Save(p,a,b,c) (p)->Save(a,b,c) +#define IDirect3DRMMeshBuilder3_Scale(p,a,b,c) (p)->Scale(a,b,c) +#define IDirect3DRMMeshBuilder3_Translate(p,a,b,c) (p)->Translate(a) +#define IDirect3DRMMeshBuilder3_SetColorSource(p,a) (p)->SetColorSource(a,b,c) +#define IDirect3DRMMeshBuilder3_GetBox(p,a) (p)->GetBox(a) +#define IDirect3DRMMeshBuilder3_GenerateNormals(p,a,b) (p)->GenerateNormals(a,b) +#define IDirect3DRMMeshBuilder3_GetColorSource(p) (p)->GetColorSource() +#define IDirect3DRMMeshBuilder3_AddMesh(p,a) (p)-->AddMesh(a) +#define IDirect3DRMMeshBuilder3_AddMeshBuilder(p,a) (p)->AddMeshBuilder(a) +#define IDirect3DRMMeshBuilder3_AddFrame(p,a) (p)->AddFrame(a) +#define IDirect3DRMMeshBuilder3_AddFace(p,a) (p)->AddFace(a) +#define IDirect3DRMMeshBuilder3_AddFaces(p,a,b,c,d,e,f) (p)->AddFaces(a,b,c,d,e,f) +#define IDirect3DRMMeshBuilder3_ReserveSpace(p,a,b,c) (p)->ReserveSpace(a,b,c) +#define IDirect3DRMMeshBuilder3_SetColorRGB(p,a,b,c) (p)->SetColorRGB(a,b,c) +#define IDirect3DRMMeshBuilder3_SetColor(p,a) (p)->SetColor(a) +#define IDirect3DRMMeshBuilder3_SetTexture(p,a) (p)->SetTexture(a) +#define IDirect3DRMMeshBuilder3_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DRMMeshBuilder3_SetTextureTopology(p,a,b) (p)->SetTextureTopology(a,b) +#define IDirect3DRMMeshBuilder3_SetQuality(p,a) (p)->SetQuality(a) +#define IDirect3DRMMeshBuilder3_SetPerspective(p,a) (p)->SetPerspective(a) +#define IDirect3DRMMeshBuilder3_SetVertex(p,a,b,c,d) (p)->SetVertex(a,b,c,d) +#define IDirect3DRMMeshBuilder3_SetNormal(p,a,b,c,d) (p)->SetNormal(a,b,c,d) +#define IDirect3DRMMeshBuilder3_SetTextureCoordinates(p,a,b,c) (p)->SetTextureCoordinates(a,b,c) +#define IDirect3DRMMeshBuilder3_SetVertexColor(p,a,b) (p)->SetVertexColor(a,b) +#define IDirect3DRMMeshBuilder3_SetVertexColorRGB(p,a,b,c,d) (p)->SetVertexColorRGB(a,b,c,d) +#define IDirect3DRMMeshBuilder3_GetFaces(p,a) (p)->GetFaces(a) +#define IDirect3DRMMeshBuilder3_GetGeometry(p,a,b,c,d,e,f) (p)->GetGeometry(a,b,c,d,e,f) +#define IDirect3DRMMeshBuilder3_GetTextureCoordinates(p,a,b,c) (p)->GetTextureCoordinates(a,b,c) +#define IDirect3DRMMeshBuilder3_AddVertex(p,a,b,c) (p)->AddVertex(a,b,c) +#define IDirect3DRMMeshBuilder3_AddNormal(p,a,b,c) (p)->AddNormal(a,b,c) +#define IDirect3DRMMeshBuilder3_CreateFace(p,a) (p)->CreateFace(a) + +#define IDirect3DRMMeshBuilder3_GetQuality(p) (p)->GetQuality() +#define IDirect3DRMMeshBuilder3_GetPerspective(p) (p)->GetPerspective() +#define IDirect3DRMMeshBuilder3_GetFaceCount(p) (p)->GetFaceCount() +#define IDirect3DRMMeshBuilder3_GetVertexCount(p) (p)->GetVertexCount() +#define IDirect3DRMMeshBuilder3_GetVertexColor(p,a) (p)->GetVertexColor(a) +#define IDirect3DRMMeshBuilder3_CreateMesh(p,a) (p)->CreateMesh(a) +#define IDirect3DRMMeshBuilder3_GetFace(p,a,b) (p)->GetFace(a,b) +#define IDirect3DRMMeshBuilder3_GetVertex(p,a,b) (p)->GetVertex(a,b) +#define IDirect3DRMMeshBuilder3_GetNormal(p,a,b) (p)->GetNormal(a,b) +#define IDirect3DRMMeshBuilder3_DeleteVertices(p,a,b) (p)->DeleteVertices(a,b) +#define IDirect3DRMMeshBuilder3_DeleteNormals(p,a,b) (p)->DeleteNormals(a,b) +#define IDirect3DRMMeshBuilder3_DeleteFace(p,a) (p)->DeleteFace(a) +#define IDirect3DRMMeshBuilder3_Empty(p,a) (p)->Empty(a) +#define IDirect3DRMMeshBuilder3_Optimize(p,a) (p)->Optimize(a) +#define IDirect3DRMMeshBuilder3_AddFacesIndexed(p,a,b,c,d) (p)->AddFacesIndexed(a,b,c,d) +#define IDirect3DRMMeshBuilder3_CreateSubMesh(p,a) (p)->CreateSubMesh(a) +#define IDirect3DRMMeshBuilder3_GetParentMesh(p,a,b) (p)->GetParentMesh(a,b) +#define IDirect3DRMMeshBuilder3_GetSubMeshes(p,a,b) (p)->GetSubMeshes(a,b) +#define IDirect3DRMMeshBuilder3_DeleteSubMesh(p,a) (p)->DeleteSubMesh(a) +#define IDirect3DRMMeshBuilder3_Enable(p,a) (p)->Enable(a) +#define IDirect3DRMMeshBuilder3_AddTriangles(p,a,b,c,d) (p)->AddTriangles(a,b,c,d) +#define IDirect3DRMMeshBuilder3_SetVertices(p,a,b,c) (p)->SetVertices(a,b,c) +#define IDirect3DRMMeshBuilder3_GetVertices(p,a,b,c) (p)->GetVertices(a,b,c) +#define IDirect3DRMMeshBuilder3_SetNormals(p,a,b,c) (p)->SetNormals(a,b,c) +#define IDirect3DRMMeshBuilder3_GetNormals(p,a,b,c) (p)->GetNormals(a,b,c) +#define IDirect3DRMMeshBuilder3_GetNormalCount(p) (p)->GetNormalCount() +#endif + +/***************************************************************************** + * IDirect3DRMLight interface + */ +#define INTERFACE IDirect3DRMLight +DECLARE_INTERFACE_(IDirect3DRMLight,IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMLight methods ***/ + STDMETHOD(SetType)(THIS_ D3DRMLIGHTTYPE) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetRange)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetUmbra)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetPenumbra)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetConstantAttenuation)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetLinearAttenuation)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetQuadraticAttenuation)(THIS_ D3DVALUE) PURE; + STDMETHOD_(D3DVALUE, GetRange)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetUmbra)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetPenumbra)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetConstantAttenuation)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetLinearAttenuation)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetQuadraticAttenuation)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; + STDMETHOD_(D3DRMLIGHTTYPE, GetType)(THIS) PURE; + STDMETHOD(SetEnableFrame)(THIS_ IDirect3DRMFrame *frame) PURE; + STDMETHOD(GetEnableFrame)(THIS_ IDirect3DRMFrame **frame) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMLight_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMLight_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMLight_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMLight_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMLight_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMLight_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMLight_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMLight_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMLight_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMLight_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMLight_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMLight methods ***/ +#define IDirect3DRMLight_SetType(p,a) (p)->lpVtbl->SetType(p,a) +#define IDirect3DRMLight_SetColor(p,a) (p)->lpVtbl->SetColor(p,a) +#define IDirect3DRMLight_SetColorRGB(p,a,b,c) (p)->lpVtbl->SetColorRGB(p,a,b,c) +#define IDirect3DRMLight_SetRange(p,a) (p)->lpVtbl->SetRange(p,a) +#define IDirect3DRMLight_SetUmbra(p,a) (p)->lpVtbl->SetUmbra(p,a) +#define IDirect3DRMLight_SetPenumbra(p,a) (p)->lpVtbl->SetPenumbra(p,a) +#define IDirect3DRMLight_SetConstantAttenuation(p,a) (p)->lpVtbl->SetConstantAttenuation(p,a) +#define IDirect3DRMLight_SetLinearAttenuation(p,a) (p)->lpVtbl->SetLinearAttenuation(p,a) +#define IDirect3DRMLight_SetQuadraticAttenuation(p,a) (p)->lpVtbl->SetQuadraticAttenuation(p,a) +#define IDirect3DRMLight_GetRange(p) (p)->lpVtbl->GetRange(p) +#define IDirect3DRMLight_GetUmbra(p) (p)->lpVtbl->GetUmbra(p) +#define IDirect3DRMLight_GetPenumbra(p) (p)->lpVtbl->GetPenumbra(p) +#define IDirect3DRMLight_GetConstantAttenuation(p) (p)->lpVtbl->GetConstantAttenuation(p) +#define IDirect3DRMLight_GetLinearAttenuation(p) (p)->lpVtbl->GetLinearAttenuation(p) +#define IDirect3DRMLight_GetQuadraticAttenuation(p) (p)->lpVtbl->GetQuadraticAttenuation(p) +#define IDirect3DRMLight_GetColor(p) (p)->lpVtbl->GetColor(p) +#define IDirect3DRMLight_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DRMLight_SetEnableFrame(p,a) (p)->lpVtbl->SetEnableFrame(p,a) +#define IDirect3DRMLight_GetEnableFrame(p,a) (p)->lpVtbl->GetEnableFrame(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMLight_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMLight_AddRef(p) (p)->AddRef() +#define IDirect3DRMLight_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMLight_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMLight_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMLight_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMLight_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMLight_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMLight_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMLight_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMLight_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMLight methods ***/ +#define IDirect3DRMLight_SetType(p,a) (p)->SetType(a) +#define IDirect3DRMLight_SetColor(p,a) (p)->SetColor(a) +#define IDirect3DRMLight_SetColorRGB(p,a,b,c) (p)->SetColorRGB(a,b,c) +#define IDirect3DRMLight_SetRange(p,a) (p)->SetRange(a) +#define IDirect3DRMLight_SetUmbra(p,a) (p)->SetUmbra(a) +#define IDirect3DRMLight_SetPenumbra(p,a) (p)->SetPenumbra(a) +#define IDirect3DRMLight_SetConstantAttenuation(p,a) (p)->SetConstantAttenuation(a) +#define IDirect3DRMLight_SetLinearAttenuation(p,a) (p)->SetLinearAttenuation(a) +#define IDirect3DRMLight_SetQuadraticAttenuation(p,a) (p)->SetQuadraticAttenuation(a) +#define IDirect3DRMLight_GetRange(p) (p)->GetRange() +#define IDirect3DRMLight_GetUmbra(p) (p)->GetUmbra() +#define IDirect3DRMLight_GetPenumbra(p) (p)->GetPenumbra() +#define IDirect3DRMLight_GetConstantAttenuation(p) (p)->GetConstantAttenuation() +#define IDirect3DRMLight_GetLinearAttenuation(p) (p)->GetLinearAttenuation() +#define IDirect3DRMLight_GetQuadraticAttenuation(p) (p)->GetQuadraticAttenuation() +#define IDirect3DRMLight_GetColor(p) (p)->GetColor() +#define IDirect3DRMLight_GetType(p) (p)->GetType() +#define IDirect3DRMLight_SetEnableFrame(p,a) (p)->SetEnableFrame(a) +#define IDirect3DRMLight_GetEnableFrame(p,a) (p)->GetEnableFrame(a) +#endif + +/***************************************************************************** + * IDirect3DRMTexture interface + */ +#define INTERFACE IDirect3DRMTexture +DECLARE_INTERFACE_(IDirect3DRMTexture, IDirect3DRMVisual) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMTexture methods ***/ + STDMETHOD(InitFromFile)(THIS_ const char *filename) PURE; + STDMETHOD(InitFromSurface)(THIS_ IDirectDrawSurface *surface) PURE; + STDMETHOD(InitFromResource)(THIS_ HRSRC) PURE; + STDMETHOD(Changed)(THIS_ BOOL pixels, BOOL palette) PURE; + STDMETHOD(SetColors)(THIS_ DWORD) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalSize)(THIS_ D3DVALUE width, D3DVALUE height) PURE; + STDMETHOD(SetDecalOrigin)(THIS_ LONG x, LONG y) PURE; + STDMETHOD(SetDecalScale)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalTransparency)(THIS_ BOOL) PURE; + STDMETHOD(SetDecalTransparentColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(GetDecalSize)(THIS_ D3DVALUE *width_return, D3DVALUE *height_return) PURE; + STDMETHOD(GetDecalOrigin)(THIS_ LONG *x_return, LONG *y_return) PURE; + STDMETHOD_(D3DRMIMAGE *, GetImage)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetColors)(THIS) PURE; + STDMETHOD_(DWORD, GetDecalScale)(THIS) PURE; + STDMETHOD_(BOOL, GetDecalTransparency)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetDecalTransparentColor)(THIS) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMTexture_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMTexture_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMTexture_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMTexture_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMTexture_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMTexture_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMTexture_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMTexture_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMTexture_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMTexture_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMTexture_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMTexture methods ***/ +#define IDirect3DRMTexture_InitFromFile(p,a) (p)->lpVtbl->InitFromFile(p,a) +#define IDirect3DRMTexture_InitFromSurface(p,a) (p)->lpVtbl->InitFromSurface(p,a) +#define IDirect3DRMTexture_InitFromResource(p,a) (p)->lpVtbl->InitFromResource(p,a) +#define IDirect3DRMTexture_Changed(p,a,b) (p)->lpVtbl->Changed(p,a,b) +#define IDirect3DRMTexture_SetColors(p,a) (p)->lpVtbl->SetColors(p,a) +#define IDirect3DRMTexture_SetShades(p,a) (p)->lpVtbl->SetShades(p,a) +#define IDirect3DRMTexture_SetDecalSize(p,a,b) (p)->lpVtbl->SetDecalSize(p,a,b) +#define IDirect3DRMTexture_SetDecalOrigin(p,a,b) (p)->lpVtbl->SetDecalOrigin(p,a,b) +#define IDirect3DRMTexture_SetDecalScale(p,a) (p)->lpVtbl->SetDecalScale(p,a) +#define IDirect3DRMTexture_SetDecalTransparency(p,a) (p)->lpVtbl->SetDecalTransparency(p,a) +#define IDirect3DRMTexture_SetDecalTransparencyColor(p,a) (p)->lpVtbl->SetDecalTransparentColor(p,a) +#define IDirect3DRMTexture_GetDecalSize(p,a,b) (p)->lpVtbl->GetDecalSize(p,a,b) +#define IDirect3DRMTexture_GetDecalOrigin(p,a,b) (p)->lpVtbl->GetDecalOrigin(p,a,b) +#define IDirect3DRMTexture_GetImage(p) (p)->lpVtbl->GetImage(p) +#define IDirect3DRMTexture_GetShades(p) (p)->lpVtbl->GetShades(p) +#define IDirect3DRMTexture_GetColors(p) (p)->lpVtbl->GetColors(p) +#define IDirect3DRMTexture_GetDecalScale(p) (p)->lpVtbl->GetDecalScale(p) +#define IDirect3DRMTexture_GetDecalTransparency(p) (p)->lpVtbl->GetDecalTransparency(p) +#define IDirect3DRMTexture_GetDecalTransparencyColor(p) (p)->lpVtbl->GetDecalTransparencyColor(p) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMTexture_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMTexture_AddRef(p) (p)->AddRef() +#define IDirect3DRMTexture_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMTexture_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMTexture_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMTexture_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMTexture_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMTexture_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMTexture_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMTexture_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMTexture_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMTexture methods ***/ +#define IDirect3DRMTexture_InitFromFile(p,a) (p)->InitFromFile(a) +#define IDirect3DRMTexture_InitFromSurface(p,a) (p)->InitFromSurface(a) +#define IDirect3DRMTexture_InitFromResource(p,a) (p)->InitFromResource(a) +#define IDirect3DRMTexture_Changed(p,a,b) (p)->Changed(a,b) +#define IDirect3DRMTexture_SetColors(p,a) (p)->SetColors(a) +#define IDirect3DRMTexture_SetShades(p,a) (p)->SetShades(a) +#define IDirect3DRMTexture_SetDecalSize(p,a,b) (p)->SetDecalSize(a,b) +#define IDirect3DRMTexture_SetDecalOrigin(p,a,b) (p)->SetDecalOrigin(a,b) +#define IDirect3DRMTexture_SetDecalScale(p,a) (p)->SetDecalScale(a) +#define IDirect3DRMTexture_SetDecalTransparency(p,a) (p)->SetDecalTransparency(a) +#define IDirect3DRMTexture_SetDecalTransparentColor(p,a) (p)->SetDecalTransparentColor(a) +#define IDirect3DRMTexture_GetDecalSize(p,a,b) (p)->GetDecalSize(a,b) +#define IDirect3DRMTexture_GetDecalOrigin(p,a,b) (p)->GetDecalOrigin(a,b) +#define IDirect3DRMTexture_GetImage(p) (p)->GetImage() +#define IDirect3DRMTexture_GetShades(p) (p)->GetShades() +#define IDirect3DRMTexture_GetColors(p) (p)->GetColors() +#define IDirect3DRMTexture_GetDecalScale(p) (p)->GetDecalScale() +#define IDirect3DRMTexture_GetDecalTransparency(p) (p)->GetDecalTransparency() +#define IDirect3DRMTexture_GetDecalTransparentColor(p) (p)->GetDecalTransparentColor() +#endif + +/***************************************************************************** + * IDirect3DRMTexture2 interface + */ +#define INTERFACE IDirect3DRMTexture2 +DECLARE_INTERFACE_(IDirect3DRMTexture2, IDirect3DRMTexture) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMTexture methods ***/ + STDMETHOD(InitFromFile)(THIS_ const char *filename) PURE; + STDMETHOD(InitFromSurface)(THIS_ IDirectDrawSurface *surface) PURE; + STDMETHOD(InitFromResource)(THIS_ HRSRC) PURE; + STDMETHOD(Changed)(THIS_ BOOL pixels, BOOL palette) PURE; + STDMETHOD(SetColors)(THIS_ DWORD) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalSize)(THIS_ D3DVALUE width, D3DVALUE height) PURE; + STDMETHOD(SetDecalOrigin)(THIS_ LONG x, LONG y) PURE; + STDMETHOD(SetDecalScale)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalTransparency)(THIS_ BOOL) PURE; + STDMETHOD(SetDecalTransparentColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(GetDecalSize)(THIS_ D3DVALUE *width_return, D3DVALUE *height_return) PURE; + STDMETHOD(GetDecalOrigin)(THIS_ LONG *x_return, LONG *y_return) PURE; + STDMETHOD_(D3DRMIMAGE *, GetImage)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetColors)(THIS) PURE; + STDMETHOD_(DWORD, GetDecalScale)(THIS) PURE; + STDMETHOD_(BOOL, GetDecalTransparency)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetDecalTransparentColor)(THIS) PURE; + /*** IDirect3DRMTexture2 methods ***/ + STDMETHOD(InitFromImage)(THIS_ D3DRMIMAGE *image) PURE; + STDMETHOD(InitFromResource2)(THIS_ HMODULE module, const char *name, const char *type) PURE; + STDMETHOD(GenerateMIPMap)(THIS_ DWORD) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMTexture2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMTexture2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMTexture2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMTexture2_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMTexture2_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMTexture2_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMTexture2_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMTexture2_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMTexture2_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMTexture2_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMTexture2_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMTexture methods ***/ +#define IDirect3DRMTexture2_InitFromFile(p,a) (p)->lpVtbl->InitFromFile(p,a) +#define IDirect3DRMTexture2_InitFromSurface(p,a) (p)->lpVtbl->InitFromSurface(p,a) +#define IDirect3DRMTexture2_InitFromResource(p,a) (p)->lpVtbl->InitFromResource(p,a) +#define IDirect3DRMTexture2_Changed(p,a,b) (p)->lpVtbl->Changed(p,a,b) +#define IDirect3DRMTexture2_SetColors(p,a) (p)->lpVtbl->SetColors(p,a) +#define IDirect3DRMTexture2_SetShades(p,a) (p)->lpVtbl->SetShades(p,a) +#define IDirect3DRMTexture2_SetDecalSize(p,a,b) (p)->lpVtbl->SetDecalSize(p,a,b) +#define IDirect3DRMTexture2_SetDecalOrigin(p,a,b) (p)->lpVtbl->SetDecalOrigin(p,a,b) +#define IDirect3DRMTexture2_SetDecalScale(p,a) (p)->lpVtbl->SetDecalScale(p,a) +#define IDirect3DRMTexture2_SetDecalTransparency(p,a) (p)->lpVtbl->SetDecalTransparency(p,a) +#define IDirect3DRMTexture2_SetDecalTransparencyColor(p,a) (p)->lpVtbl->SetDecalTransparentColor(p,a) +#define IDirect3DRMTexture2_GetDecalSize(p,a,b) (p)->lpVtbl->GetDecalSize(p,a,b) +#define IDirect3DRMTexture2_GetDecalOrigin(p,a,b) (p)->lpVtbl->GetDecalOrigin(p,a,b) +#define IDirect3DRMTexture2_GetImage(p) (p)->lpVtbl->GetImage(p) +#define IDirect3DRMTexture2_GetShades(p) (p)->lpVtbl->GetShades(p) +#define IDirect3DRMTexture2_GetColors(p) (p)->lpVtbl->GetColors(p) +#define IDirect3DRMTexture2_GetDecalScale(p) (p)->lpVtbl->GetDecalScale(p) +#define IDirect3DRMTexture2_GetDecalTransparency(p) (p)->lpVtbl->GetDecalTransparency(p) +#define IDirect3DRMTexture2_GetDecalTransparencyColor(p) (p)->lpVtbl->GetDecalTransparencyColor(p) +/*** IDirect3DRMTexture2 methods ***/ +#define IDirect3DRMTexture2_InitFromImage(p,a) (p)->lpVtbl->InitFromImage(p,a) +#define IDirect3DRMTexture2_InitFromResource2(p,a,b,c) (p)->lpVtbl->InitFromResource2(p,a,b,c) +#define IDirect3DRMTexture2_GenerateMIPMap(p,a) (p)->lpVtbl->GenerateMIPMap(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMTexture2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMTexture2_AddRef(p) (p)->AddRef() +#define IDirect3DRMTexture2_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMTexture2_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMTexture2_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMTexture2_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMTexture2_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMTexture2_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMTexture2_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMTexture2_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMTexture2_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMTexture methods ***/ +#define IDirect3DRMTexture2_InitFromFile(p,a) (p)->InitFromFile(a) +#define IDirect3DRMTexture2_InitFromSurface(p,a) (p)->InitFromSurface(a) +#define IDirect3DRMTexture2_InitFromResource(p,a) (p)->InitFromResource(a) +#define IDirect3DRMTexture2_Changed(p,a,b) (p)->Changed(a,b) +#define IDirect3DRMTexture2_SetColors(p,a) (p)->SetColors(a) +#define IDirect3DRMTexture2_SetShades(p,a) (p)->SetShades(a) +#define IDirect3DRMTexture2_SetDecalSize(p,a,b) (p)->SetDecalSize(a,b) +#define IDirect3DRMTexture2_SetDecalOrigin(p,a,b) (p)->SetDecalOrigin(a,b) +#define IDirect3DRMTexture2_SetDecalScale(p,a) (p)->SetDecalScale(a) +#define IDirect3DRMTexture2_SetDecalTransparency(p,a) (p)->SetDecalTransparency(a) +#define IDirect3DRMTexture2_SetDecalTransparentColor(p,a) (p)->SetDecalTransparentColor(a) +#define IDirect3DRMTexture2_GetDecalSize(p,a,b) (p)->GetDecalSize(a,b) +#define IDirect3DRMTexture2_GetDecalOrigin(p,a,b) (p)->GetDecalOrigin(a,b) +#define IDirect3DRMTexture2_GetImage(p) (p)->GetImage() +#define IDirect3DRMTexture2_GetShades(p) (p)->GetShades() +#define IDirect3DRMTexture2_GetColors(p) (p)->GetColors() +#define IDirect3DRMTexture2_GetDecalScale(p) (p)->GetDecalScale() +#define IDirect3DRMTexture2_GetDecalTransparency(p) (p)->GetDecalTransparency() +#define IDirect3DRMTexture2_GetDecalTransparentColor(p) (p)->GetDecalTransparentColor() +/*** IDirect3DRMTexture2 methods ***/ +#define IDirect3DRMTexture2_InitFromImage(p,a) (p)->InitFromImage(a) +#define IDirect3DRMTexture2_InitFromResource2(p,a,b,c) (p)->InitFromResource2(a,b,c) +#define IDirect3DRMTexture2_GenerateMIPMap(p,a) (p)->GenerateMIPMap(a) +#endif + +/***************************************************************************** + * IDirect3DRMTexture3 interface + */ +#define INTERFACE IDirect3DRMTexture3 +DECLARE_INTERFACE_(IDirect3DRMTexture3, IDirect3DRMVisual) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMTexture3 methods ***/ + STDMETHOD(InitFromFile)(THIS_ const char *filename) PURE; + STDMETHOD(InitFromSurface)(THIS_ IDirectDrawSurface *surface) PURE; + STDMETHOD(InitFromResource)(THIS_ HRSRC) PURE; + STDMETHOD(Changed)(THIS_ DWORD flags, DWORD rect_count, RECT *rects) PURE; + STDMETHOD(SetColors)(THIS_ DWORD) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalSize)(THIS_ D3DVALUE width, D3DVALUE height) PURE; + STDMETHOD(SetDecalOrigin)(THIS_ LONG x, LONG y) PURE; + STDMETHOD(SetDecalScale)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalTransparency)(THIS_ BOOL) PURE; + STDMETHOD(SetDecalTransparentColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(GetDecalSize)(THIS_ D3DVALUE *width_return, D3DVALUE *height_return) PURE; + STDMETHOD(GetDecalOrigin)(THIS_ LONG *x_return, LONG *y_return) PURE; + STDMETHOD_(D3DRMIMAGE *, GetImage)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetColors)(THIS) PURE; + STDMETHOD_(DWORD, GetDecalScale)(THIS) PURE; + STDMETHOD_(BOOL, GetDecalTransparency)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetDecalTransparentColor)(THIS) PURE; + STDMETHOD(InitFromImage)(THIS_ D3DRMIMAGE *image) PURE; + STDMETHOD(InitFromResource2)(THIS_ HMODULE module, const char *name, const char *type) PURE; + STDMETHOD(GenerateMIPMap)(THIS_ DWORD) PURE; + STDMETHOD(GetSurface)(THIS_ DWORD flags, IDirectDrawSurface **surface) PURE; + STDMETHOD(SetCacheOptions)(THIS_ LONG lImportance, DWORD dwFlags) PURE; + STDMETHOD(GetCacheOptions)(THIS_ LONG *importance, DWORD *flags) PURE; + STDMETHOD(SetDownsampleCallback)(THIS_ D3DRMDOWNSAMPLECALLBACK cb, void *ctx) PURE; + STDMETHOD(SetValidationCallback)(THIS_ D3DRMVALIDATIONCALLBACK cb, void *ctx) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMTexture3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMTexture3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMTexture3_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMTexture3_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMTexture3_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMTexture3_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMTexture3_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMTexture3_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMTexture3_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMTexture3_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMTexture3_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMTexture3 methods ***/ +#define IDirect3DRMTexture3_InitFromFile(p,a) (p)->lpVtbl->InitFromFile(p,a) +#define IDirect3DRMTexture3_InitFromSurface(p,a) (p)->lpVtbl->InitFromSurface(p,a) +#define IDirect3DRMTexture3_InitFromResource(p,a) (p)->lpVtbl->InitFromResource(p,a) +#define IDirect3DRMTexture3_Changed(p,a,b,c) (p)->lpVtbl->Changed(p,a,b,c) +#define IDirect3DRMTexture3_SetColors(p,a) (p)->lpVtbl->SetColors(p,a) +#define IDirect3DRMTexture3_SetShades(p,a) (p)->lpVtbl->SetShades(p,a) +#define IDirect3DRMTexture3_SetDecalSize(p,a,b) (p)->lpVtbl->SetDecalSize(p,a,b) +#define IDirect3DRMTexture3_SetDecalOrigin(p,a,b) (p)->lpVtbl->SetDecalOrigin(p,a,b) +#define IDirect3DRMTexture3_SetDecalScale(p,a) (p)->lpVtbl->SetDecalScale(p,a) +#define IDirect3DRMTexture3_SetDecalTransparency(p,a) (p)->lpVtbl->SetDecalTransparency(p,a) +#define IDirect3DRMTexture3_SetDecalTransparentColor(p,a) (p)->lpVtbl->SetDecalTransparentColor(p,a) +#define IDirect3DRMTexture3_GetDecalSize(p,a,b) (p)->lpVtbl->GetDecalSize(p,a,b) +#define IDirect3DRMTexture3_GetDecalOrigin(p,a,b) (p)->lpVtbl->GetDecalOrigin(p,a,b) +#define IDirect3DRMTexture3_GetImage(p) (p)->lpVtbl->GetImage(p) +#define IDirect3DRMTexture3_GetShades(p) (p)->lpVtbl->GetShades(p) +#define IDirect3DRMTexture3_GetColors(p) (p)->lpVtbl->GetColors(p) +#define IDirect3DRMTexture3_GetDecalScale(p) (p)->lpVtbl->GetDecalScale(p) +#define IDirect3DRMTexture3_GetDecalTransparency(p) (p)->lpVtbl->GetDecalTransparency(p) +#define IDirect3DRMTexture3_GetDecalTransparentColor(p) (p)->lpVtbl->GetDecalTransparentColor(p) +#define IDirect3DRMTexture3_InitFromImage(p,a) (p)->lpVtbl->InitFromImage(p,a) +#define IDirect3DRMTexture3_InitFromResource2(p,a,b,c) (p)->lpVtbl->InitFromResource2(p,a,b,c) +#define IDirect3DRMTexture3_GenerateMIPMap(p,a) (p)->lpVtbl->GenerateMIPMap(p,a) +#define IDirect3DRMTexture3_GetSurface(p,a,b) (p)->lpVtbl->GetSurface(p,a,b) +#define IDirect3DRMTexture3_SetCacheOptions(p,a,b) (p)->lpVtbl->SetCacheOptions(p,a,b) +#define IDirect3DRMTexture3_GetCacheOptions(p,a,b) (p)->lpVtbl->GetCacheOptions(p,a,b) +#define IDirect3DRMTexture3_SetDownsampleCallback(p,a,b) (p)->lpVtbl->SetDownsampleCallback(p,a,b) +#define IDirect3DRMTexture3_SetValidationCallback(p,a,b) (p)->lpVtbl->SetValidationCallback(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMTexture3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMTexture3_AddRef(p) (p)->AddRef() +#define IDirect3DRMTexture3_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMTexture3_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMTexture3_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMTexture3_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMTexture3_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMTexture3_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMTexture3_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMTexture3_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMTexture3_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMTexture3 methods ***/ +#define IDirect3DRMTexture3_InitFromFile(p,a) (p)->InitFromFile(a) +#define IDirect3DRMTexture3_InitFromSurface(p,a) (p)->InitFromSurface(a) +#define IDirect3DRMTexture3_InitFromResource(p,a) (p)->InitFromResource(a) +#define IDirect3DRMTexture3_Changed(p,a,b,c) (p)->Changed(a,b,c) +#define IDirect3DRMTexture3_SetColors(p,a) (p)->SetColors(a) +#define IDirect3DRMTexture3_SetShades(p,a) (p)->SetShades(a) +#define IDirect3DRMTexture3_SetDecalSize(p,a,b) (p)->SetDecalSize(a,b) +#define IDirect3DRMTexture3_SetDecalOrigin(p,a,b) (p)->SetDecalOrigin(a,b) +#define IDirect3DRMTexture3_SetDecalScale(p,a) (p)->SetDecalScale(a) +#define IDirect3DRMTexture3_SetDecalTransparency(p,a) (p)->SetDecalTransparency(a) +#define IDirect3DRMTexture3_SetDecalTransparencyColor(p,a) (p)->SetDecalTransparentColor(a) +#define IDirect3DRMTexture3_GetDecalSize(p,a,b) (p)->GetDecalSize(a,b) +#define IDirect3DRMTexture3_GetDecalOrigin(p,a,b) (p)->GetDecalOrigin(a,b) +#define IDirect3DRMTexture3_GetImage(p) (p)->GetImage() +#define IDirect3DRMTexture3_GetShades(p) (p)->GetShades() +#define IDirect3DRMTexture3_GetColors(p) (p)->GetColors() +#define IDirect3DRMTexture3_GetDecalScale(p) (p)->GetDecalScale() +#define IDirect3DRMTexture3_GetDecalTransparency(p) (p)->GetDecalTransparency() +#define IDirect3DRMTexture3_GetDecalTransparencyColor(p) (p)->GetDecalTransparencyColor() +#define IDirect3DRMTexture3_InitFromImage(p,a) (p)->InitFromImage(a) +#define IDirect3DRMTexture3_InitFromResource2(p,a,b,c) (p)->InitFromResource2(a,b,c) +#define IDirect3DRMTexture3_GenerateMIPMap(p,a) (p)->GenerateMIPMap(a) +#define IDirect3DRMTexture3_GetSurface(p,a,b) (p)->GetSurface(a,b) +#define IDirect3DRMTexture3_SetCacheOptions(p,a,b) (p)->SetCacheOptions(a,b) +#define IDirect3DRMTexture3_GetCacheOptions(p,a,b) (p)->GetCacheOptions(a,b) +#define IDirect3DRMTexture3_SetDownsampleCallback(p,a,b) (p)->SetDownsampleCallback(a,b) +#define IDirect3DRMTexture3_SetValidationCallback(p,a,b) (p)->SetValidationCallback(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMWrap interface + */ +#define INTERFACE IDirect3DRMWrap +DECLARE_INTERFACE_(IDirect3DRMWrap, IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMWrap methods ***/ + STDMETHOD(Init)(THIS_ D3DRMWRAPTYPE type, IDirect3DRMFrame *reference, D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, + D3DVALUE ou, D3DVALUE ov, D3DVALUE su, D3DVALUE sv) PURE; + STDMETHOD(Apply)(THIS_ IDirect3DRMObject *object) PURE; + STDMETHOD(ApplyRelative)(THIS_ IDirect3DRMFrame *frame, IDirect3DRMObject *object) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMWrap_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMWrap_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMWrap_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMWrap_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMWrap_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMWrap_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMWrap_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMWrap_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMWrap_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMWrap_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMWrap_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMWrap methods ***/ +#define IDirect3DRMWrap_Init(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) (p)->lpVtbl->Init(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) +#define IDirect3DRMWrap_Apply(p,a) (p)->lpVtbl->Apply(p,a) +#define IDirect3DRMWrap_ApplyRelative(p,a,b) (p)->lpVtbl->ApplyRelative(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMWrap_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMWrap_AddRef(p) (p)->AddRef() +#define IDirect3DRMWrap_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMWrap_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMWrap_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMWrap_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMWrap_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMWrap_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMWrap_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMWrap_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMWrap_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMWrap methods ***/ +#define IDirect3DRMWrap_Init(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) (p)->Init(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) +#define IDirect3DRMWrap_Apply(p,a) (p)->Apply(a) +#define IDirect3DRMWrap_ApplyRelative(p,a,b) (p)->ApplyRelative(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMMaterial interface + */ +#define INTERFACE IDirect3DRMMaterial +DECLARE_INTERFACE_(IDirect3DRMMaterial, IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMMaterial methods ***/ + STDMETHOD(SetPower)(THIS_ D3DVALUE power) PURE; + STDMETHOD(SetSpecular)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; + STDMETHOD(SetEmissive)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; + STDMETHOD_(D3DVALUE, GetPower)(THIS) PURE; + STDMETHOD(GetSpecular)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; + STDMETHOD(GetEmissive)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMMaterial_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMMaterial_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMMaterial_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMMaterial_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMMaterial_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMMaterial_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMMaterial_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMMaterial_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMMaterial_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMMaterial_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMMaterial_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMMaterial methods ***/ +#define IDirect3DRMMaterial_SetPower(p,a) (p)->lpVtbl->SetPower(p,a) +#define IDirect3DRMMaterial_SetSpecular(p,a,b,c) (p)->lpVtbl->SetSpecular(p,a,b,c) +#define IDirect3DRMMaterial_SetEmissive(p,a,b,c) (p)->lpVtbl->SetEmissive(p,a,b,c) +#define IDirect3DRMMaterial_GetPower(p) (p)->lpVtbl->GetPower(p) +#define IDirect3DRMMaterial_GetSpecular(p,a,b,c) (p)->lpVtbl->GetSpecular(p,a,b,c) +#define IDirect3DRMMaterial_GetEmissive(p,a,b,c) (p)->lpVtbl->GetEmissive(p,a,b,c) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMMaterial_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMMaterial_AddRef(p) (p)->AddRef() +#define IDirect3DRMMaterial_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMMaterial_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMMaterial_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMMaterial_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMMaterial_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMMaterial_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMMaterial_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMMaterial_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMMaterial_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMMaterial methods ***/ +#define IDirect3DRMMaterial_SetPower(p,a) (p)->SetPower(a) +#define IDirect3DRMMaterial_SetSpecular(p,a,b,c) (p)->SetSpecular(a,b,c) +#define IDirect3DRMMaterial_SetEmissive(p,a,b,c) (p)->SetEmissive(a,b,c) +#define IDirect3DRMMaterial_GetPower(p) (p)->GetPower() +#define IDirect3DRMMaterial_GetSpecular(p,a,b,c) (p)->GetSpecular(a,b,c) +#define IDirect3DRMMaterial_GetEmissive(p,a,b,c) (p)->GetEmissive(a,b,c) +#endif + +/***************************************************************************** + * IDirect3DRMMaterial2 interface + */ +#define INTERFACE IDirect3DRMMaterial2 +DECLARE_INTERFACE_(IDirect3DRMMaterial2, IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMMaterial2 methods ***/ + STDMETHOD(SetPower)(THIS_ D3DVALUE power) PURE; + STDMETHOD(SetSpecular)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; + STDMETHOD(SetEmissive)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; + STDMETHOD_(D3DVALUE, GetPower)(THIS) PURE; + STDMETHOD(GetSpecular)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; + STDMETHOD(GetEmissive)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; + STDMETHOD(GetAmbient)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; + STDMETHOD(SetAmbient)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMMaterial2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMMaterial2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMMaterial2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMMaterial2_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMMaterial2_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMMaterial2_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMMaterial2_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMMaterial2_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMMaterial2_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMMaterial2_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMMaterial2_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMMaterial2 methods ***/ +#define IDirect3DRMMaterial2_SetPower(p,a) (p)->lpVtbl->SetPower(p,a) +#define IDirect3DRMMaterial2_SetSpecular(p,a,b,c) (p)->lpVtbl->SetSpecular(p,a,b,c) +#define IDirect3DRMMaterial2_SetEmissive(p,a,b,c) (p)->lpVtbl->SetEmissive(p,a,b,c) +#define IDirect3DRMMaterial2_GetPower(p) (p)->lpVtbl->GetPower(p) +#define IDirect3DRMMaterial2_GetSpecular(p,a,b,c) (p)->lpVtbl->GetSpecular(p,a,b,c) +#define IDirect3DRMMaterial2_GetEmissive(p,a,b,c) (p)->lpVtbl->GetEmissive(p,a,b,c) +#define IDirect3DRMMaterial2_SetAmbient(p,a,b,c) (p)->lpVtbl->SetAmbient(p,a,b,c) +#define IDirect3DRMMaterial2_GetAmbient(p,a,b,c) (p)->lpVtbl->GetAmbient(p,a,b,c) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMMaterial2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMMaterial2_AddRef(p) (p)->AddRef() +#define IDirect3DRMMaterial2_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMMaterial2_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMMaterial2_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMMaterial2_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMMaterial2_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMMaterial2_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMMaterial2_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMMaterial2_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMMaterial2_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMMaterial2 methods ***/ +#define IDirect3DRMMaterial2_SetPower(p,a) (p)->SetPower(a) +#define IDirect3DRMMaterial2_SetSpecular(p,a,b,c) (p)->SetSpecular(a,b,c) +#define IDirect3DRMMaterial2_SetEmissive(p,a,b,c) (p)->SetEmissive(a,b,c) +#define IDirect3DRMMaterial2_GetPower(p) (p)->GetPower() +#define IDirect3DRMMaterial2_GetSpecular(p,a,b,c) (p)->GetSpecular(a,b,c) +#define IDirect3DRMMaterial2_GetEmissive(p,a,b,c) (p)->GetEmissive(a,b,c) +#define IDirect3DRMMaterial2_SetAmbient(p,a,b,c) (p)->SetAmbient(a,b,c) +#define IDirect3DRMMaterial2_GetAmbient(p,a,b,c) (p)->GetAmbient(a,b,c) +#endif + +/***************************************************************************** + * IDirect3DRMAnimation interface + */ +#define INTERFACE IDirect3DRMAnimation +DECLARE_INTERFACE_(IDirect3DRMAnimation, IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMAnimation methods ***/ + STDMETHOD(SetOptions)(THIS_ D3DRMANIMATIONOPTIONS flags) PURE; + STDMETHOD(AddRotateKey)(THIS_ D3DVALUE time, D3DRMQUATERNION *q) PURE; + STDMETHOD(AddPositionKey)(THIS_ D3DVALUE time, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScaleKey)(THIS_ D3DVALUE time, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(DeleteKey)(THIS_ D3DVALUE time) PURE; + STDMETHOD(SetFrame)(THIS_ IDirect3DRMFrame *frame) PURE; + STDMETHOD(SetTime)(THIS_ D3DVALUE time) PURE; + STDMETHOD_(D3DRMANIMATIONOPTIONS, GetOptions)(THIS) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMAnimation_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMAnimation_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMAnimation_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMAnimation_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMAnimation_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMAnimation_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMAnimation_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMAnimation_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMAnimation_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMAnimation_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMAnimation_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMAnimation methods ***/ +#define IDirect3DRMAnimation_SetOptions(p,a) (p)->lpVtbl->SetOptions(p,a) +#define IDirect3DRMAnimation_AddRotateKey(p,a,b) (p)->lpVtbl->AddRotateKey(p,a,b) +#define IDirect3DRMAnimation_AddPositionKey(p,a,b,c,d) (p)->lpVtbl->AddPositionKey(p,a,b,c,d) +#define IDirect3DRMAnimation_AddScaleKey(p,a,b,c,d) (p)->lpVtbl->AddScaleKey(p,a,b,c,d) +#define IDirect3DRMAnimation_DeleteKey(p,a) (p)->lpVtbl->DeleteKey(p,a) +#define IDirect3DRMAnimation_SetFrame(p,a) (p)->lpVtbl->SetFrame(p,a) +#define IDirect3DRMAnimation_SetTime(p,a) (p)->lpVtbl->SetTime(p,a) +#define IDirect3DRMAnimation_GetOptions(p) (p)->lpVtbl->GetOptions(p) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMAnimation_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMAnimation_AddRef(p) (p)->AddRef() +#define IDirect3DRMAnimation_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMAnimation_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMAnimation_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMAnimation_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMAnimation_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMAnimation_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMAnimation_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMAnimation_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMAnimation_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMAnimation methods ***/ +#define IDirect3DRMAnimation_SetOptions(p,a) (p)->SetOptions(a) +#define IDirect3DRMAnimation_AddRotateKey(p,a,b) (p)->AddRotateKey(a,b) +#define IDirect3DRMAnimation_AddPositionKey(p,a,b,c,d) (p)->AddPositionKey(a,b,c,d) +#define IDirect3DRMAnimation_AddScaleKey(p,a,b,c,d) (p)->AddScaleKey(a,b,c,d) +#define IDirect3DRMAnimation_DeleteKey(p,a) (p)->DeleteKey(a) +#define IDirect3DRMAnimation_SetFrame(p,a) (p)->SetFrame(a) +#define IDirect3DRMAnimation_SetTime(p,a) (p)->SetTime(a) +#define IDirect3DRMAnimation_GetOptions(p) (p)->GetOptions() +#endif + +/***************************************************************************** + * IDirect3DRMAnimation2 interface + */ +#define INTERFACE IDirect3DRMAnimation2 +DECLARE_INTERFACE_(IDirect3DRMAnimation2, IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMAnimation2 methods ***/ + STDMETHOD(SetOptions)(THIS_ D3DRMANIMATIONOPTIONS flags) PURE; + STDMETHOD(AddRotateKey)(THIS_ D3DVALUE time, D3DRMQUATERNION *q) PURE; + STDMETHOD(AddPositionKey)(THIS_ D3DVALUE time, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScaleKey)(THIS_ D3DVALUE time, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(DeleteKey)(THIS_ D3DVALUE time) PURE; + STDMETHOD(SetFrame)(THIS_ IDirect3DRMFrame3 *frame) PURE; + STDMETHOD(SetTime)(THIS_ D3DVALUE time) PURE; + STDMETHOD_(D3DRMANIMATIONOPTIONS, GetOptions)(THIS) PURE; + STDMETHOD(GetFrame)(THIS_ IDirect3DRMFrame3 **frame) PURE; + STDMETHOD(DeleteKeyByID)(THIS_ DWORD dwID) PURE; + STDMETHOD(AddKey)(THIS_ D3DRMANIMATIONKEY *key) PURE; + STDMETHOD(ModifyKey)(THIS_ D3DRMANIMATIONKEY *key) PURE; + STDMETHOD(GetKeys)(THIS_ D3DVALUE time_min, D3DVALUE time_max, DWORD *key_count, D3DRMANIMATIONKEY *keys); +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMAnimation2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMAnimation2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMAnimation2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMAnimation2_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMAnimation2_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMAnimation2_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMAnimation2_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMAnimation2_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMAnimation2_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMAnimation2_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMAnimation2_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMAnimation2 methods ***/ +#define IDirect3DRMAnimation2_SetOptions(p,a) (p)->lpVtbl->SetOptions(p,a) +#define IDirect3DRMAnimation2_AddRotateKey(p,a,b) (p)->lpVtbl->AddRotateKey(p,a,b) +#define IDirect3DRMAnimation2_AddPositionKey(p,a,b,c,d) (p)->lpVtbl->AddPositionKey(p,a,b,c,d) +#define IDirect3DRMAnimation2_AddScaleKey(p,a,b,c,d) (p)->lpVtbl->AddScaleKey(p,a,b,c,d) +#define IDirect3DRMAnimation2_DeleteKey(p,a) (p)->lpVtbl->DeleteKey(p,a) +#define IDirect3DRMAnimation2_SetFrame(p,a) (p)->lpVtbl->SetFrame(p,a) +#define IDirect3DRMAnimation2_SetTime(p,a) (p)->lpVtbl->SetTime(p,a) +#define IDirect3DRMAnimation2_GetOptions(p) (p)->lpVtbl->GetOptions(p) +#define IDirect3DRMAnimation2_GetFrame(p,a) (p)->lpVtbl->GetFrame(p,a) +#define IDirect3DRMAnimation2_DeleteKeyByID(p,a) (p)->lpVtbl->DeleteKeyByID(p,a) +#define IDirect3DRMAnimation2_AddKey(p,a) (p)->lpVtbl->AddKey(p,a) +#define IDirect3DRMAnimation2_ModifyKey(p,a) (p)->lpVtbl->ModifyKey(p,a) +#define IDirect3DRMAnimation2_GetKeys(p,a,b,c,d) (p)->lpVtbl->GetKeys(p,a,b,c,d) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMAnimation2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMAnimation2_AddRef(p) (p)->AddRef() +#define IDirect3DRMAnimation2_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMAnimation2_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMAnimation2_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMAnimation2_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMAnimation2_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMAnimation2_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMAnimation2_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMAnimation2_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMAnimation2_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMAnimation2 methods ***/ +#define IDirect3DRMAnimation2_SetOptions(p,a) (p)->SetOptions(a) +#define IDirect3DRMAnimation2_AddRotateKey(p,a,b) (p)->AddRotateKey(a,b) +#define IDirect3DRMAnimation2_AddPositionKey(p,a,b,c,d) (p)->AddPositionKey(a,b,c,d) +#define IDirect3DRMAnimation2_AddScaleKey(p,a,b,c,d) (p)->AddScaleKey(a,b,c,d) +#define IDirect3DRMAnimation2_DeleteKey(p,a) (p)->DeleteKey(a) +#define IDirect3DRMAnimation2_SetFrame(p,a) (p)->SetFrame(a) +#define IDirect3DRMAnimation2_SetTime(p,a) (p)->SetTime(a) +#define IDirect3DRMAnimation2_GetOptions(p) (p)->GetOptions() +#define IDirect3DRMAnimation2_GetFrame(p,a) (p)->GetFrame(a) +#define IDirect3DRMAnimation2_DeleteKeyByID(p,a) (p)->DeleteKeyByID(a) +#define IDirect3DRMAnimation2_AddKey(p,a) (p)->AddKey(a) +#define IDirect3DRMAnimation2_ModifyKey(p,a) (p)->ModifyKey(a) +#define IDirect3DRMAnimation2_GetKeys(p,a,b,c,d) (p)->GetKeys(a,b,c,d) +#endif + +/***************************************************************************** + * IDirect3DRMAnimationSet interface + */ +#define INTERFACE IDirect3DRMAnimationSet +DECLARE_INTERFACE_(IDirect3DRMAnimationSet, IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMAnimationSet methods ***/ + STDMETHOD(AddAnimation)(THIS_ IDirect3DRMAnimation *animation) PURE; + STDMETHOD(Load)(THIS_ void *filename, void *name, D3DRMLOADOPTIONS flags, + D3DRMLOADTEXTURECALLBACK cb, void *ctx, IDirect3DRMFrame *parent)PURE; + STDMETHOD(DeleteAnimation)(THIS_ IDirect3DRMAnimation *animation) PURE; + STDMETHOD(SetTime)(THIS_ D3DVALUE time) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMAnimationSet_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMAnimationSet_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMAnimationSet_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMAnimationSet_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMAnimationSet_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMAnimationSet_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMAnimationSet_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMAnimationSet_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMAnimationSet_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMAnimationSet_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMAnimationSet_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMAnimationSet methods ***/ +#define IDirect3DRMAnimationSet_AddAnimation(p,a) (p)->lpVtbl->AddAnimation(p,a) +#define IDirect3DRMAnimationSet_Load(p,a,b,c,d,e,f) (p)->lpVtbl->Load(p,a,b,c,d,e,f) +#define IDirect3DRMAnimationSet_DeleteAnimation(p,a) (p)->lpVtbl->DeleteAnimation(p,a) +#define IDirect3DRMAnimationSet_SetTime(p,a) (p)->lpVtbl->SetTime(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMAnimationSet_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMAnimationSet_AddRef(p) (p)->AddRef() +#define IDirect3DRMAnimationSet_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMAnimationSet_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMAnimationSet_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMAnimationSet_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMAnimationSet_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMAnimationSet_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMAnimationSet_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMAnimationSet_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMAnimationSet_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMAnimationSet methods ***/ +#define IDirect3DRMAnimationSet_AddAnimation(p,a) (p)->AddAnimation(a) +#define IDirect3DRMAnimationSet_Load(p,a,b,c,d,e,f) (p)->Load(a,b,c,d,e,f) +#define IDirect3DRMAnimationSet_DeleteAnimation(p,a) (p)->DeleteAnimation(a) +#define IDirect3DRMAnimationSet_SetTime(p,a) (p)->SetTime(a) +#endif + +/***************************************************************************** + * IDirect3DRMAnimationSet2 interface + */ +#define INTERFACE IDirect3DRMAnimationSet2 +DECLARE_INTERFACE_(IDirect3DRMAnimationSet2, IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMAnimationSet2 methods ***/ + STDMETHOD(AddAnimation)(THIS_ IDirect3DRMAnimation2 *animation) PURE; + STDMETHOD(Load)(THIS_ void *source, void *object_id, D3DRMLOADOPTIONS flags, + D3DRMLOADTEXTURE3CALLBACK cb, void *ctx, IDirect3DRMFrame3 *parent_frame)PURE; + STDMETHOD(DeleteAnimation)(THIS_ IDirect3DRMAnimation2 *animation) PURE; + STDMETHOD(SetTime)(THIS_ D3DVALUE time) PURE; + STDMETHOD(GetAnimations)(THIS_ struct IDirect3DRMAnimationArray **array) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMAnimationSet2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMAnimationSet2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMAnimationSet2_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMAnimationSet2_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMAnimationSet2_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMAnimationSet2_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMAnimationSet2_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMAnimationSet2_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMAnimationSet2_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMAnimationSet2_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMAnimationSet2_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMAnimationSet2 methods ***/ +#define IDirect3DRMAnimationSet2_AddAnimation(p,a) (p)->lpVtbl->AddAnimation(p,a) +#define IDirect3DRMAnimationSet2_Load(p,a,b,c,d,e,f) (p)->lpVtbl->Load(p,a,b,c,d,e,f) +#define IDirect3DRMAnimationSet2_DeleteAnimation(p,a) (p)->lpVtbl->DeleteAnimation(p,a) +#define IDirect3DRMAnimationSet2_SetTime(p,a) (p)->lpVtbl->SetTime(p,a) +#define IDirect3DRMAnimationSet2_GetAnimations(p,a) (p)->lpVtbl->GetAnimations(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMAnimationSet2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMAnimationSet2_AddRef(p) (p)->AddRef() +#define IDirect3DRMAnimationSet2_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMAnimationSet2_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMAnimationSet2_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMAnimationSet2_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMAnimationSet2_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMAnimationSet2_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMAnimationSet2_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMAnimationSet2_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMAnimationSet2_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMAnimationSet2 methods ***/ +#define IDirect3DRMAnimationSet2_AddAnimation(p,a) (p)->AddAnimation(a) +#define IDirect3DRMAnimationSet2_Load(p,a,b,c,d,e,f) (p)->Load(a,b,c,d,e,f) +#define IDirect3DRMAnimationSet2_DeleteAnimation(p,a) (p)->DeleteAnimation(a) +#define IDirect3DRMAnimationSet2_SetTime(p,a) (p)->SetTime(a) +#define IDirect3DRMAnimationSet2_GetAnimations(p,a) (p)->GetAnimations(a) +#endif + +/***************************************************************************** + * IDirect3DRMUserVisual interface + */ +#define INTERFACE IDirect3DRMUserVisual +DECLARE_INTERFACE_(IDirect3DRMUserVisual, IDirect3DRMVisual) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMUserVisual methods ***/ + STDMETHOD(Init)(THIS_ D3DRMUSERVISUALCALLBACK fn, void *arg) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMUserVisual_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMUserVisual_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMUserVisual_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMUserVisual_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMUserVisual_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMUserVisual_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMUserVisual_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMUserVisual_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMUserVisual_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMUserVisual_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMUserVisual_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMUserVisual methods ***/ +#define IDirect3DRMUserVisual_Init(p,a,b) (p)->lpVtbl->Init(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMUserVisual_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMUserVisual_AddRef(p) (p)->AddRef() +#define IDirect3DRMUserVisual_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMUserVisual_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMUserVisual_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMUserVisual_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMUserVisual_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMUserVisual_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMUserVisual_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMUserVisual_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMUserVisual_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMUserVisual methods ***/ +#define IDirect3DRMUserVisual_Init(p,a,b) (p)->Init(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMArray interface + */ +#define INTERFACE IDirect3DRMArray +DECLARE_INTERFACE_(IDirect3DRMArray, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMArray methods ***/ + STDMETHOD_(DWORD, GetSize)(THIS) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMArray_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMArray_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMArray_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMArray_GetSize(p) (p)->lpVtbl->GetSize(p) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMArray_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMArray_AddRef(p) (p)->AddRef() +#define IDirect3DRMArray_Release(p) (p)->Release() +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMArray_GetSize(p) (p)->GetSize() +#endif + +/***************************************************************************** + * IDirect3DRMObjectArray interface + */ +#define INTERFACE IDirect3DRMObjectArray +DECLARE_INTERFACE_(IDirect3DRMObjectArray, IDirect3DRMArray) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMArray methods ***/ + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + /*** IDirect3DRMObjectArray methods ***/ + STDMETHOD(GetElement)(THIS_ DWORD index, IDirect3DRMObject **element) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMObjectArray_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMObjectArray_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMObjectArray_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMObjectArray_GetSize(p) (p)->lpVtbl->GetSize(p) +/*** IDirect3DRMObjectArray methods ***/ +#define IDirect3DRMObjectArray_GetElement(p,a,b) (p)->lpVtbl->GetElement(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMObjectArray_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMObjectArray_AddRef(p) (p)->AddRef() +#define IDirect3DRMObjectArray_Release(p) (p)->Release() +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMObjectArray_GetSize(p) (p)->GetSize() +/*** IDirect3DRMObjectArray methods ***/ +#define IDirect3DRMObjectArray_GetElement(p,a,b) (p)->GetElement(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMDeviceArray interface + */ +#define INTERFACE IDirect3DRMDeviceArray +DECLARE_INTERFACE_(IDirect3DRMDeviceArray, IDirect3DRMArray) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMArray methods ***/ + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + /*** IDirect3DRMDeviceArray methods ***/ + STDMETHOD(GetElement)(THIS_ DWORD index, IDirect3DRMDevice **element) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMDeviceArray_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMDeviceArray_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMDeviceArray_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMDeviceArray_GetSize(p) (p)->lpVtbl->GetSize(p) +/*** IDirect3DRMDeviceArray methods ***/ +#define IDirect3DRMDeviceArray_GetElement(p,a,b) (p)->lpVtbl->GetElement(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMDeviceArray_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMDeviceArray_AddRef(p) (p)->AddRef() +#define IDirect3DRMDeviceArray_Release(p) (p)->Release() +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMDeviceArray_GetSize(p) (p)->GetSize() +/*** IDirect3DRMDeviceArray methods ***/ +#define IDirect3DRMDeviceArray_GetElement(p,a,b) (p)->GetElement(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMFrameArray interface + */ +#define INTERFACE IDirect3DRMFrameArray +DECLARE_INTERFACE_(IDirect3DRMFrameArray, IDirect3DRMArray) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMArray methods ***/ + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + /*** IDirect3DRMFrameArray methods ***/ + STDMETHOD(GetElement)(THIS_ DWORD index, IDirect3DRMFrame **element) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMFrameArray_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMFrameArray_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMFrameArray_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMFrameArray_GetSize(p) (p)->lpVtbl->GetSize(p) +/*** IDirect3DRMFrameArray methods ***/ +#define IDirect3DRMFrameArray_GetElement(p,a,b) (p)->lpVtbl->GetElement(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMFrameArray_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMFrameArray_AddRef(p) (p)->AddRef() +#define IDirect3DRMFrameArray_Release(p) (p)->Release() +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMFrameArray_GetSize(p) (p)->GetSize() +/*** IDirect3DRMFrameArray methods ***/ +#define IDirect3DRMFrameArray_GetElement(p,a,b) (p)->GetElement(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMViewportArray interface + */ +#define INTERFACE IDirect3DRMViewportArray +DECLARE_INTERFACE_(IDirect3DRMViewportArray, IDirect3DRMArray) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMArray methods ***/ + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + /*** IDirect3DRMViewportArray methods ***/ + STDMETHOD(GetElement)(THIS_ DWORD index, IDirect3DRMViewport **element) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMViewportArray_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMViewportArray_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMViewportArray_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMViewportArray_GetSize(p) (p)->lpVtbl->GetSize(p) +/*** IDirect3DRMViewportArray methods ***/ +#define IDirect3DRMViewportArray_GetElement(p,a,b) (p)->lpVtbl->GetElement(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMViewportArray_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMViewportArray_AddRef(p) (p)->AddRef() +#define IDirect3DRMViewportArray_Release(p) (p)->Release() +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMViewportArray_GetSize(p) (p)->GetSize() +/*** IDirect3DRMViewportArray methods ***/ +#define IDirect3DRMviewportArray_GetElement(p,a,b) (p)->GetElement(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMVisualArray interface + */ +#define INTERFACE IDirect3DRMVisualArray +DECLARE_INTERFACE_(IDirect3DRMVisualArray, IDirect3DRMArray) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMArray methods ***/ + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + /*** IDirect3DRMVisualArray methods ***/ + STDMETHOD(GetElement)(THIS_ DWORD index, IDirect3DRMVisual **element) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMVisualArray_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMVisualArray_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMVisualArray_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMVisualArray_GetSize(p) (p)->lpVtbl->GetSize(p) +/*** IDirect3DRMVisualArray methods ***/ +#define IDirect3DRMVisualArray_GetElement(p,a,b) (p)->lpVtbl->GetElement(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMVisualArray_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMVisualArray_AddRef(p) (p)->AddRef() +#define IDirect3DRMVisualArray_Release(p) (p)->Release() +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMVisualArray_GetSize(p) (p)->GetSize() +/*** IDirect3DRMVisualArray methods ***/ +#define IDirect3DRMVisualArray_GetElement(p,a,b) (p)->GetElement(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMAnimationArray interface + */ +#define INTERFACE IDirect3DRMAnimationArray +DECLARE_INTERFACE_(IDirect3DRMAnimationArray, IDirect3DRMArray) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMArray methods ***/ + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + /*** IDirect3DRMAnimationArray methods ***/ + STDMETHOD(GetElement)(THIS_ DWORD index, IDirect3DRMAnimation2 **element) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMAnimationArray_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMAnimationArray_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMAnimationArray_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMAnimationArray_GetSize(p) (p)->lpVtbl->GetSize(p) +/*** IDirect3DRMAnimationArray methods ***/ +#define IDirect3DRMAnimationArray_GetElement(p,a,b) (p)->lpVtbl->GetElement(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMAnimationArray_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMAnimationArray_AddRef(p) (p)->AddRef() +#define IDirect3DRMAnimationArray_Release(p) (p)->Release() +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMAnimationArray_GetSize(p) (p)->GetSize() +/*** IDirect3DRMAnimationArray methods ***/ +#define IDirect3DRMAnimationArray_GetElement(p,a,b) (p)->GetElement(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMPickedArray interface + */ +#define INTERFACE IDirect3DRMPickedArray +DECLARE_INTERFACE_(IDirect3DRMPickedArray, IDirect3DRMArray) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMArray methods ***/ + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + /*** IDirect3DRMPickedArray methods ***/ + STDMETHOD(GetPick)(THIS_ DWORD index, IDirect3DRMVisual **visual, + IDirect3DRMFrameArray **frame_array, D3DRMPICKDESC *pick_desc) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMPickedArray_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMPickedArray_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMPickedArray_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMPickedArray_GetSize(p) (p)->lpVtbl->GetSize(p) +/*** IDirect3DRMPickedArray methods ***/ +#define IDirect3DRMPickedArray_GetPick(p,a,b,c,d) (p)->lpVtbl->GetPick(p,a,b,c,d) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMPickedArray_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMPickedArray_AddRef(p) (p)->AddRef() +#define IDirect3DRMPickedArray_Release(p) (p)->Release() +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMPickedArray_GetSize(p) (p)->GetSize() +/*** IDirect3DRMPickedArray methods ***/ +#define IDirect3DRMPickedArray_GetPick(p,a,b,c,d) (p)->GetPick(a,b,c,d) +#endif + +/***************************************************************************** + * IDirect3DRMLightArray interface + */ +#define INTERFACE IDirect3DRMLightArray +DECLARE_INTERFACE_(IDirect3DRMLightArray, IDirect3DRMArray) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMArray methods ***/ + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + /*** IDirect3DRMLightArray methods ***/ + STDMETHOD(GetElement)(THIS_ DWORD index, IDirect3DRMLight **element) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMLightArray_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMLightArray_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMLightArray_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMLightArray_GetSize(p) (p)->lpVtbl->GetSize(p) +/*** IDirect3DRMLightArray methods ***/ +#define IDirect3DRMLightArray_GetElement(p,a,b) (p)->lpVtbl->GetElement(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMLightArray_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMLightArray_AddRef(p) (p)->AddRef() +#define IDirect3DRMLightArray_Release(p) (p)->Release() +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMLightArray_GetSize(p) (p)->GetSize() +/*** IDirect3DRMLightArray methods ***/ +#define IDirect3DRMLightArray_GetElement(p,a,b) (p)->GetElement(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMFaceArray interface + */ +#define INTERFACE IDirect3DRMFaceArray +DECLARE_INTERFACE_(IDirect3DRMFaceArray, IDirect3DRMArray) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMArray methods ***/ + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + /*** IDirect3DRMFaceArray methods ***/ + STDMETHOD(GetElement)(THIS_ DWORD index, IDirect3DRMFace **element) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMFaceArray_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMFaceArray_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMFaceArray_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMFaceArray_GetSize(p) (p)->lpVtbl->GetSize(p) +/*** IDirect3DRMFaceArray methods ***/ +#define IDirect3DRMFaceArray_GetElement(p,a,b) (p)->lpVtbl->GetElement(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMFaceArray_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMFaceArray_AddRef(p) (p)->AddRef() +#define IDirect3DRMFaceArray_Release(p) (p)->Release() +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMFaceArray_GetSize(p) (p)->GetSize() +/*** IDirect3DRMFaceArray methods ***/ +#define IDirect3DRMFaceArray_GetElement(p,a,b) (p)->GetElement(a,b) +#endif + +/***************************************************************************** + * IDirect3DRMPicked2Array interface + */ +#define INTERFACE IDirect3DRMPicked2Array +DECLARE_INTERFACE_(IDirect3DRMPicked2Array, IDirect3DRMArray) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMArray methods ***/ + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + /*** IDirect3DRMPicked2Array methods ***/ + STDMETHOD(GetPick)(THIS_ DWORD index, IDirect3DRMVisual **visual, + IDirect3DRMFrameArray **frame_array, D3DRMPICKDESC2 *pick_desc) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMPicked2Array_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMPicked2Array_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMPicked2Array_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMPicked2Array_GetSize(p) (p)->lpVtbl->GetSize(p) +/*** IDirect3DRMPicked2Array methods ***/ +#define IDirect3DRMPicked2Array_GetPick(p,a,b,c,d) (p)->lpVtbl->GetPick(p,a,b,c,d) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMPicked2Array_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMPicked2Array_AddRef(p) (p)->AddRef() +#define IDirect3DRMPicked2Array_Release(p) (p)->Release() +/*** IDirect3DRMArray methods ***/ +#define IDirect3DRMPicked2Array_GetSize(p) (p)->GetSize() +/*** IDirect3DRMPicked2Array methods ***/ +#define IDirect3DRMPicked2Array_GetPick(p,a,b,c,d) (p)->GetPick(a,b,c,d) +#endif + +/***************************************************************************** + * IDirect3DRMInterpolator interface + */ +#define INTERFACE IDirect3DRMInterpolator +DECLARE_INTERFACE_(IDirect3DRMInterpolator, IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMInterpolator methods ***/ + STDMETHOD(AttachObject)(THIS_ IDirect3DRMObject *object) PURE; + STDMETHOD(GetAttachedObjects)(THIS_ IDirect3DRMObjectArray **array) PURE; + STDMETHOD(DetachObject)(THIS_ IDirect3DRMObject *object) PURE; + STDMETHOD(SetIndex)(THIS_ D3DVALUE) PURE; + STDMETHOD_(D3DVALUE, GetIndex)(THIS) PURE; + STDMETHOD(Interpolate)(THIS_ D3DVALUE index, IDirect3DRMObject *object, D3DRMINTERPOLATIONOPTIONS flags) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMInterpolator_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMInterpolator_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMInterpolator_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMInterpolator_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMInterpolator_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMInterpolator_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMInterpolator_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMInterpolator_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMInterpolator_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMInterpolator_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMInterpolator_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMInterpolator methods ***/ +#define IDirect3DRMInterpolator_AttachObject(p,a) (p)->lpVtbl->AttachObject(p,a) +#define IDirect3DRMInterpolator_GetAttachedObjects(p,a) (p)->lpVtbl->GetAttachedObjects(p,a) +#define IDirect3DRMInterpolator_DetachObject(p,a) (p)->lpVtbl->DetachObject(p,a) +#define IDirect3DRMInterpolator_SetIndex(p,a) (p)->lpVtbl->SetIndex(p,a) +#define IDirect3DRMInterpolator_GetIndex(p) (p)->lpVtbl->GetIndex(p) +#define IDirect3DRMInterpolator_Interpolate(p,a,b,c) (p)->lpVtbl->Interpolate(p,a,b,c) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMInterpolator_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMInterpolator_AddRef(p) (p)->AddRef() +#define IDirect3DRMInterpolator_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMInterpolator_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMInterpolator_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMInterpolator_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMInterpolator_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMInterpolator_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMInterpolator_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMInterpolator_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMInterpolator_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMInterpolator methods ***/ +#define IDirect3DRMInterpolator_AttachObject(p,a) (p)->AttachObject(a) +#define IDirect3DRMInterpolator_GetAttachedObjects(p,a) (p)->GetAttachedObjects(a) +#define IDirect3DRMInterpolator_DetachObject(p,a) (p)->DetachObject(a) +#define IDirect3DRMInterpolator_SetIndex(p,a) (p)->SetIndex(a) +#define IDirect3DRMInterpolator_GetIndex(p) (p)->GetIndex() +#define IDirect3DRMInterpolator_Interpolate(p,a,b,c) (p)->Interpolate(a,b,c) +#endif + +/***************************************************************************** + * IDirect3DRMClippedVisual interface + */ +#define INTERFACE IDirect3DRMClippedVisual +DECLARE_INTERFACE_(IDirect3DRMClippedVisual, IDirect3DRMVisual) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMClippedVisual methods ***/ + STDMETHOD(Init) (THIS_ IDirect3DRMVisual *visual) PURE; + STDMETHOD(AddPlane) (THIS_ IDirect3DRMFrame3 *reference, D3DVECTOR *point, + D3DVECTOR *normal, DWORD flags, DWORD *id) PURE; + STDMETHOD(DeletePlane)(THIS_ DWORD, DWORD) PURE; + STDMETHOD(GetPlaneIDs)(THIS_ DWORD *count, DWORD *id, DWORD flags) PURE; + STDMETHOD(GetPlane) (THIS_ DWORD id, IDirect3DRMFrame3 *reference, D3DVECTOR *point, + D3DVECTOR *normal, DWORD flags) PURE; + STDMETHOD(SetPlane) (THIS_ DWORD id, IDirect3DRMFrame3 *reference, D3DVECTOR *point, + D3DVECTOR *normal, DWORD flags) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMClippedVisual_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMClippedVisual_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMClippedVisual_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMClippedVisual_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMClippedVisual_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMClippedVisual_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMClippedVisual_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMClippedVisual_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMClippedVisual_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMClippedVisual_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMClippedVisual_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMClippedVisual methods ***/ +#define IDirect3DRMClippedVisual_Init(p,a) (p)->lpVtbl->Init(p,a) +#define IDirect3DRMClippedVisual_AddPlane(p,a,b,c,d,e) (p)->lpVtbl->AddPlane(p,a,b,c,d,e) +#define IDirect3DRMClippedVisual_DeletePlane(p,a,b) (p)->lpVtbl->DeletePlane(p,a,b) +#define IDirect3DRMClippedVisual_GetPlaneIDs(p,a,b,c) (p)->lpVtbl->GetPlaneIDs(p,a,b,c) +#define IDirect3DRMClippedVisual_GetPlane(p,a,b,c,d,e) (p)->lpVtbl->GetPlane(p,a,b,c,d,e) +#define IDirect3DRMClippedVisual_SetPlane(p,a,b,c,d,e) (p)->lpVtbl->SetPlane(p,a,b,c,d,e) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMClippedVisual_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMClippedVisual_AddRef(p) (p)->AddRef() +#define IDirect3DRMClippedVisual_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMClippedVisual_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMClippedVisual_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMClippedVisual_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMClippedVisual_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMClippedVisual_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMClippedVisual_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMClippedVisual_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMClippedVisual_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMClippedVisual methods ***/ +#define IDirect3DRMClippedVisual_Init(p,a) (p)->Init(a) +#define IDirect3DRMClippedVisual_AddPlane(p,a,b,c,d,e) (p)->AddPlane(a,b,c,d,e) +#define IDirect3DRMClippedVisual_DeletePlane(p,a,b) (p)->DeletePlane(a,b) +#define IDirect3DRMClippedVisual_GetPlaneIDs(p,a,b,c) (p)->GetPlaneIDs(a,b,c) +#define IDirect3DRMClippedVisual_GetPlane(p,a,b,c,d,e) (p)->GetPlane(a,b,c,d,e) +#define IDirect3DRMClippedVisual_SetPlane(p,a,b,c,d,e) (p)->SetPlane(a,b,c,d,e) +#endif + +#ifdef __cplusplus +}; +#endif + +#endif /* __D3DRMOBJ_H__ */ diff --git a/3rdparty/d3drm/include/d3drmwin.h b/3rdparty/d3drm/include/d3drmwin.h new file mode 100644 index 00000000..bd3a40d8 --- /dev/null +++ b/3rdparty/d3drm/include/d3drmwin.h @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2010 Vijay Kiran Kamuju + * + * 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 __D3DRMWIN_H__ +#define __D3DRMWIN_H__ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************************************************************** + * Direct3DRMWinDevice interface GUID + */ + +DEFINE_GUID(IID_IDirect3DRMWinDevice, 0xc5016cc0, 0xd273, 0x11ce, 0xac, 0x48, 0x00, 0x00, 0xc0, 0x38, 0x25, 0xa1); + +typedef struct IDirect3DRMWinDevice *LPDIRECT3DRMWINDEVICE, **LPLPDIRECT3DRMWINDEVICE; + +/***************************************************************************** + * IDirect3DRMWinDevice interface + */ +#define INTERFACE IDirect3DRMWinDevice +DECLARE_INTERFACE_(IDirect3DRMWinDevice,IDirect3DRMObject) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirect3DRMObject methods ***/ + STDMETHOD(Clone)(THIS_ IUnknown *outer, REFIID iid, void **out) PURE; + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK cb, void *ctx) PURE; + STDMETHOD(SetAppData)(THIS_ DWORD data) PURE; + STDMETHOD_(DWORD, GetAppData)(THIS) PURE; + STDMETHOD(SetName)(THIS_ const char *name) PURE; + STDMETHOD(GetName)(THIS_ DWORD *size, char *name) PURE; + STDMETHOD(GetClassName)(THIS_ DWORD *size, char *name) PURE; + /*** IDirect3DRMWinDevice methods ***/ + STDMETHOD(HandlePaint)(THIS_ HDC) PURE; + STDMETHOD(HandleActivate)(THIS_ WORD) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDirect3DRMWinDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DRMWinDevice_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DRMWinDevice_Release(p) (p)->lpVtbl->Release(p) +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMWinDevice_Clone(p,a,b,c) (p)->lpVtbl->Clone(p,a,b,c) +#define IDirect3DRMWinDevice_AddDestroyCallback(p,a,b) (p)->lpVtbl->AddDestroyCallback(p,a,b) +#define IDirect3DRMWinDevice_DeleteDestroyCallback(p,a,b) (p)->lpVtbl->DeleteDestroyCallback(p,a,b) +#define IDirect3DRMWinDevice_SetAppData(p,a) (p)->lpVtbl->SetAppData(p,a) +#define IDirect3DRMWinDevice_GetAppData(p) (p)->lpVtbl->GetAppData(p) +#define IDirect3DRMWinDevice_SetName(p,a) (p)->lpVtbl->SetName(p,a) +#define IDirect3DRMWinDevice_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b) +#define IDirect3DRMWinDevice_GetClassName(p,a,b) (p)->lpVtbl->GetClassName(p,a,b) +/*** IDirect3DRMWinDevice methods ***/ +#define IDirect3DRMWinDevice_HandlePaint(p,a) (p)->lpVtbl->HandlePaint(p,a) +#define IDirect3DRMWinDevice_HandleActivate(p,a) (p)->lpVtbl->HandleActivate(p,a) +#else +/*** IUnknown methods ***/ +#define IDirect3DRMWinDevice_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DRMWinDevice_AddRef(p) (p)->AddRef() +#define IDirect3DRMwinDevice_Release(p) (p)->Release() +/*** IDirect3DRMObject methods ***/ +#define IDirect3DRMWinDevice_Clone(p,a,b,c) (p)->Clone(a,b,c) +#define IDirect3DRMWinDevice_AddDestroyCallback(p,a,b) (p)->AddDestroyCallback(a,b) +#define IDirect3DRMWinDevice_DeleteDestroyCallback(p,a,b) (p)->DeleteDestroyCallback(a,b) +#define IDirect3DRMWinDevice_SetAppData(p,a) (p)->SetAppData(a) +#define IDirect3DRMWinDevice_GetAppData(p) (p)->GetAppData() +#define IDirect3DRMWinDevice_SetName(p,a) (p)->SetName(a) +#define IDirect3DRMWinDevice_GetName(p,a,b) (p)->GetName(a,b) +#define IDirect3DRMWinDevice_GetClassName(p,a,b) (p)->GetClassName(a,b) +/*** IDirect3DRMWinDevice methods ***/ +#define IDirect3DRMWinDevice_HandlePaint(p,a) (p)->HandlePaint(a) +#define IDirect3DRMWinDevice_HandleActivate(p,a) (p)->HandleActivate(a) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __D3DRMWIN_H__ */ diff --git a/3rdparty/d3drm/light.c b/3rdparty/d3drm/light.c new file mode 100644 index 00000000..704c11c0 --- /dev/null +++ b/3rdparty/d3drm/light.c @@ -0,0 +1,391 @@ +/* + * Implementation of IDirect3DRMLight Interface + * + * Copyright 2012 André Hentschel + * + * 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 + */ + +#include "d3drm_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d3drm); + +static inline struct d3drm_light *impl_from_IDirect3DRMLight(IDirect3DRMLight *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_light, IDirect3DRMLight_iface); +} + +static HRESULT WINAPI d3drm_light_QueryInterface(IDirect3DRMLight *iface, REFIID riid, void **out) +{ + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRMLight) + || IsEqualGUID(riid, &IID_IDirect3DRMObject) + || IsEqualGUID(riid, &IID_IUnknown)) + { + IDirect3DRMLight_AddRef(iface); + *out = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI d3drm_light_AddRef(IDirect3DRMLight *iface) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + ULONG refcount = InterlockedIncrement(&light->ref); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI d3drm_light_Release(IDirect3DRMLight *iface) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + ULONG refcount = InterlockedDecrement(&light->ref); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + { + d3drm_object_cleanup((IDirect3DRMObject *)iface, &light->obj); + IDirect3DRM_Release(light->d3drm); + free(light); + } + + return refcount; +} + +static HRESULT WINAPI d3drm_light_Clone(IDirect3DRMLight *iface, + IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_light_AddDestroyCallback(IDirect3DRMLight *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_add_destroy_callback(&light->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_light_DeleteDestroyCallback(IDirect3DRMLight *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_delete_destroy_callback(&light->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_light_SetAppData(IDirect3DRMLight *iface, DWORD data) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + light->obj.appdata = data; + + return D3DRM_OK; +} + +static DWORD WINAPI d3drm_light_GetAppData(IDirect3DRMLight *iface) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p.\n", iface); + + return light->obj.appdata; +} + +static HRESULT WINAPI d3drm_light_SetName(IDirect3DRMLight *iface, const char *name) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_object_set_name(&light->obj, name); +} + +static HRESULT WINAPI d3drm_light_GetName(IDirect3DRMLight *iface, DWORD *size, char *name) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_name(&light->obj, size, name); +} + +static HRESULT WINAPI d3drm_light_GetClassName(IDirect3DRMLight *iface, DWORD *size, char *name) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_class_name(&light->obj, size, name); +} + +static HRESULT WINAPI d3drm_light_SetType(IDirect3DRMLight *iface, D3DRMLIGHTTYPE type) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p, type %#x.\n", iface, type); + + light->type = type; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_light_SetColor(IDirect3DRMLight *iface, D3DCOLOR color) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p, color 0x%08lx.\n", iface, color); + + light->color = 0xff000000 | color; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_light_SetColorRGB(IDirect3DRMLight *iface, + D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue); + + d3drm_set_color(&light->color, red, green, blue, 1.0f); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_light_SetRange(IDirect3DRMLight *iface, D3DVALUE range) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p, range %.8e.\n", iface, range); + + light->range = range; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_light_SetUmbra(IDirect3DRMLight *iface, D3DVALUE umbra) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p, umbra %.8e.\n", iface, umbra); + + light->umbra = umbra; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_light_SetPenumbra(IDirect3DRMLight *iface, D3DVALUE penumbra) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p, penumbra %.8e.\n", iface, penumbra); + + light->penumbra = penumbra; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_light_SetConstantAttenuation(IDirect3DRMLight *iface, D3DVALUE attenuation) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p, attenuation %.8e.\n", iface, attenuation); + + light->cattenuation = attenuation; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_light_SetLinearAttenuation(IDirect3DRMLight *iface, D3DVALUE attenuation) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p, attenuation %.8e.\n", iface, attenuation); + + light->lattenuation = attenuation; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_light_SetQuadraticAttenuation(IDirect3DRMLight *iface, D3DVALUE attenuation) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p, attenuation %.8e.\n", iface, attenuation); + + light->qattenuation = attenuation; + + return D3DRM_OK; +} + +static D3DVALUE WINAPI d3drm_light_GetRange(IDirect3DRMLight *iface) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p.\n", iface); + + return light->range; +} + +static D3DVALUE WINAPI d3drm_light_GetUmbra(IDirect3DRMLight *iface) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p.\n", light); + + return light->umbra; +} + +static D3DVALUE WINAPI d3drm_light_GetPenumbra(IDirect3DRMLight *iface) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p.\n", iface); + + return light->penumbra; +} + +static D3DVALUE WINAPI d3drm_light_GetConstantAttenuation(IDirect3DRMLight *iface) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p.\n", iface); + + return light->cattenuation; +} + +static D3DVALUE WINAPI d3drm_light_GetLinearAttenuation(IDirect3DRMLight *iface) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p.\n", iface); + + return light->lattenuation; +} + +static D3DVALUE WINAPI d3drm_light_GetQuadraticAttenuation(IDirect3DRMLight *iface) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p.\n", iface); + + return light->qattenuation; +} + +static D3DCOLOR WINAPI d3drm_light_GetColor(IDirect3DRMLight *iface) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p.\n", iface); + + return light->color; +} + +static D3DRMLIGHTTYPE WINAPI d3drm_light_GetType(IDirect3DRMLight *iface) +{ + struct d3drm_light *light = impl_from_IDirect3DRMLight(iface); + + TRACE("iface %p.\n", iface); + + return light->type; +} + +static HRESULT WINAPI d3drm_light_SetEnableFrame(IDirect3DRMLight *iface, IDirect3DRMFrame *frame) +{ + FIXME("iface %p, frame %p stub!\n", iface, frame); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_light_GetEnableFrame(IDirect3DRMLight *iface, IDirect3DRMFrame **frame) +{ + FIXME("iface %p, frame %p stub!\n", iface, frame); + + return E_NOTIMPL; +} + +static const struct IDirect3DRMLightVtbl d3drm_light_vtbl = +{ + d3drm_light_QueryInterface, + d3drm_light_AddRef, + d3drm_light_Release, + d3drm_light_Clone, + d3drm_light_AddDestroyCallback, + d3drm_light_DeleteDestroyCallback, + d3drm_light_SetAppData, + d3drm_light_GetAppData, + d3drm_light_SetName, + d3drm_light_GetName, + d3drm_light_GetClassName, + d3drm_light_SetType, + d3drm_light_SetColor, + d3drm_light_SetColorRGB, + d3drm_light_SetRange, + d3drm_light_SetUmbra, + d3drm_light_SetPenumbra, + d3drm_light_SetConstantAttenuation, + d3drm_light_SetLinearAttenuation, + d3drm_light_SetQuadraticAttenuation, + d3drm_light_GetRange, + d3drm_light_GetUmbra, + d3drm_light_GetPenumbra, + d3drm_light_GetConstantAttenuation, + d3drm_light_GetLinearAttenuation, + d3drm_light_GetQuadraticAttenuation, + d3drm_light_GetColor, + d3drm_light_GetType, + d3drm_light_SetEnableFrame, + d3drm_light_GetEnableFrame, +}; + +HRESULT d3drm_light_create(struct d3drm_light **light, IDirect3DRM *d3drm) +{ + static const char classname[] = "Light"; + struct d3drm_light *object; + + TRACE("light %p.\n", light); + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IDirect3DRMLight_iface.lpVtbl = &d3drm_light_vtbl; + object->ref = 1; + object->d3drm = d3drm; + IDirect3DRM_AddRef(object->d3drm); + + d3drm_object_init(&object->obj, classname); + + *light = object; + + return S_OK; +} diff --git a/3rdparty/d3drm/material.c b/3rdparty/d3drm/material.c new file mode 100644 index 00000000..726768fa --- /dev/null +++ b/3rdparty/d3drm/material.c @@ -0,0 +1,303 @@ +/* + * Implementation of IDirect3DRMMaterial2 interface + * + * Copyright 2012 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 + */ + +#include "d3drm_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d3drm); + +static inline struct d3drm_material *impl_from_IDirect3DRMMaterial2(IDirect3DRMMaterial2 *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_material, IDirect3DRMMaterial2_iface); +} + +static HRESULT WINAPI d3drm_material_QueryInterface(IDirect3DRMMaterial2 *iface, REFIID riid, void **out) +{ + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRMMaterial2) + || IsEqualGUID(riid, &IID_IDirect3DRMMaterial) + || IsEqualGUID(riid, &IID_IDirect3DRMObject) + || IsEqualGUID(riid, &IID_IUnknown)) + { + IDirect3DRMMaterial2_AddRef(iface); + *out = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI d3drm_material_AddRef(IDirect3DRMMaterial2 *iface) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + ULONG refcount = InterlockedIncrement(&material->ref); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI d3drm_material_Release(IDirect3DRMMaterial2 *iface) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + ULONG refcount = InterlockedDecrement(&material->ref); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + { + d3drm_object_cleanup((IDirect3DRMObject *)iface, &material->obj); + IDirect3DRM_Release(material->d3drm); + free(material); + } + + return refcount; +} + +static HRESULT WINAPI d3drm_material_Clone(IDirect3DRMMaterial2 *iface, + IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_material_AddDestroyCallback(IDirect3DRMMaterial2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_add_destroy_callback(&material->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_material_DeleteDestroyCallback(IDirect3DRMMaterial2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_delete_destroy_callback(&material->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_material_SetAppData(IDirect3DRMMaterial2 *iface, DWORD data) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + material->obj.appdata = data; + + return D3DRM_OK; +} + +static DWORD WINAPI d3drm_material_GetAppData(IDirect3DRMMaterial2 *iface) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + + TRACE("iface %p.\n", iface); + + return material->obj.appdata; +} + +static HRESULT WINAPI d3drm_material_SetName(IDirect3DRMMaterial2 *iface, const char *name) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_object_set_name(&material->obj, name); +} + +static HRESULT WINAPI d3drm_material_GetName(IDirect3DRMMaterial2 *iface, DWORD *size, char *name) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_name(&material->obj, size, name); +} + +static HRESULT WINAPI d3drm_material_GetClassName(IDirect3DRMMaterial2 *iface, DWORD *size, char *name) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_class_name(&material->obj, size, name); +} + +static HRESULT WINAPI d3drm_material_SetPower(IDirect3DRMMaterial2 *iface, D3DVALUE power) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + + TRACE("iface %p, power %.8e.\n", iface, power); + + material->power = power; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_material_SetSpecular(IDirect3DRMMaterial2 *iface, + D3DVALUE r, D3DVALUE g, D3DVALUE b) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + + TRACE("iface %p, r %.8e, g %.8e, b %.8e.\n", iface, r, g, b); + + material->specular.r = r; + material->specular.g = g; + material->specular.b = b; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_material_SetEmissive(IDirect3DRMMaterial2 *iface, + D3DVALUE r, D3DVALUE g, D3DVALUE b) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + + TRACE("iface %p, r %.8e, g %.8e, b %.8e.\n", iface, r, g, b); + + material->emissive.r = r; + material->emissive.g = g; + material->emissive.b = b; + + return D3DRM_OK; +} + +static D3DVALUE WINAPI d3drm_material_GetPower(IDirect3DRMMaterial2 *iface) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + + TRACE("iface %p.\n", iface); + + return material->power; +} + +static HRESULT WINAPI d3drm_material_GetSpecular(IDirect3DRMMaterial2 *iface, + D3DVALUE *r, D3DVALUE *g, D3DVALUE *b) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + + TRACE("iface %p, r %p, g %p, b %p.\n", iface, r, g, b); + + *r = material->specular.r; + *g = material->specular.g; + *b = material->specular.b; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_material_GetEmissive(IDirect3DRMMaterial2 *iface, + D3DVALUE *r, D3DVALUE *g, D3DVALUE *b) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + + TRACE("iface %p, r %p, g %p, b %p.\n", iface, r, g, b); + + *r = material->emissive.r; + *g = material->emissive.g; + *b = material->emissive.b; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_material_GetAmbient(IDirect3DRMMaterial2 *iface, + D3DVALUE *r, D3DVALUE *g, D3DVALUE *b) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + + TRACE("iface %p, r %p, g %p, b %p.\n", iface, r, g, b); + + *r = material->ambient.r; + *g = material->ambient.g; + *b = material->ambient.b; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_material_SetAmbient(IDirect3DRMMaterial2 *iface, + D3DVALUE r, D3DVALUE g, D3DVALUE b) +{ + struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface); + + TRACE("iface %p, r %.8e, g %.8e, b %.8e.\n", iface, r, g, b); + + material->ambient.r = r; + material->ambient.g = g; + material->ambient.b = b; + + return D3DRM_OK; +} + +static const struct IDirect3DRMMaterial2Vtbl d3drm_material_vtbl = +{ + d3drm_material_QueryInterface, + d3drm_material_AddRef, + d3drm_material_Release, + d3drm_material_Clone, + d3drm_material_AddDestroyCallback, + d3drm_material_DeleteDestroyCallback, + d3drm_material_SetAppData, + d3drm_material_GetAppData, + d3drm_material_SetName, + d3drm_material_GetName, + d3drm_material_GetClassName, + d3drm_material_SetPower, + d3drm_material_SetSpecular, + d3drm_material_SetEmissive, + d3drm_material_GetPower, + d3drm_material_GetSpecular, + d3drm_material_GetEmissive, + d3drm_material_GetAmbient, + d3drm_material_SetAmbient, +}; + +HRESULT d3drm_material_create(struct d3drm_material **material, IDirect3DRM *d3drm) +{ + static const char classname[] = "Material"; + struct d3drm_material *object; + + TRACE("material %p, d3drm %p.\n", material, d3drm); + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IDirect3DRMMaterial2_iface.lpVtbl = &d3drm_material_vtbl; + object->ref = 1; + object->d3drm = d3drm; + IDirect3DRM_AddRef(object->d3drm); + + object->specular.r = 1.0f; + object->specular.g = 1.0f; + object->specular.b = 1.0f; + + d3drm_object_init(&object->obj, classname); + + *material = object; + + return S_OK; +} diff --git a/3rdparty/d3drm/math.c b/3rdparty/d3drm/math.c new file mode 100644 index 00000000..b0b95079 --- /dev/null +++ b/3rdparty/d3drm/math.c @@ -0,0 +1,263 @@ +/* + * Copyright 2007 David Adam + * Copyright 2007 Vijay Kiran Kamuju + * + * 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 + */ + +#include "d3drm_private.h" + +/* Create a RGB color from its components */ +D3DCOLOR WINAPI D3DRMCreateColorRGB(D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + return D3DRMCreateColorRGBA(red, green, blue, 1.0f); +} +/* Create a RGBA color from its components */ +D3DCOLOR WINAPI D3DRMCreateColorRGBA(D3DVALUE red, D3DVALUE green, D3DVALUE blue, D3DVALUE alpha) +{ + D3DCOLOR color; + + d3drm_set_color(&color, red, green, blue, alpha); + + return color; +} + +/* Determine the alpha part of a color */ +D3DVALUE WINAPI D3DRMColorGetAlpha(D3DCOLOR color) +{ + return (RGBA_GETALPHA(color)/255.0); +} + +/* Determine the blue part of a color */ +D3DVALUE WINAPI D3DRMColorGetBlue(D3DCOLOR color) +{ + return (RGBA_GETBLUE(color)/255.0); +} + +/* Determine the green part of a color */ +D3DVALUE WINAPI D3DRMColorGetGreen(D3DCOLOR color) +{ + return (RGBA_GETGREEN(color)/255.0); +} + +/* Determine the red part of a color */ +D3DVALUE WINAPI D3DRMColorGetRed(D3DCOLOR color) +{ + return (RGBA_GETRED(color)/255.0); +} + +/* Product of 2 quaternions */ +D3DRMQUATERNION * WINAPI D3DRMQuaternionMultiply(D3DRMQUATERNION *q, D3DRMQUATERNION *a, D3DRMQUATERNION *b) +{ + D3DRMQUATERNION temp; + D3DVECTOR cross_product; + + D3DRMVectorCrossProduct(&cross_product, &a->v, &b->v); + temp.s = a->s * b->s - D3DRMVectorDotProduct(&a->v, &b->v); + temp.v.x = a->s * b->v.x + b->s * a->v.x + cross_product.x; + temp.v.y = a->s * b->v.y + b->s * a->v.y + cross_product.y; + temp.v.z = a->s * b->v.z + b->s * a->v.z + cross_product.z; + + *q = temp; + return q; +} + +/* Matrix for the Rotation that a unit quaternion represents */ +void WINAPI D3DRMMatrixFromQuaternion(D3DRMMATRIX4D m, D3DRMQUATERNION *q) +{ + D3DVALUE w,x,y,z; + w = q->s; + x = q->v.x; + y = q->v.y; + z = q->v.z; + m[0][0] = 1.0-2.0*(y*y+z*z); + m[1][1] = 1.0-2.0*(x*x+z*z); + m[2][2] = 1.0-2.0*(x*x+y*y); + m[1][0] = 2.0*(x*y+z*w); + m[0][1] = 2.0*(x*y-z*w); + m[2][0] = 2.0*(x*z-y*w); + m[0][2] = 2.0*(x*z+y*w); + m[2][1] = 2.0*(y*z+x*w); + m[1][2] = 2.0*(y*z-x*w); + m[3][0] = 0.0; + m[3][1] = 0.0; + m[3][2] = 0.0; + m[0][3] = 0.0; + m[1][3] = 0.0; + m[2][3] = 0.0; + m[3][3] = 1.0; +} + +/* Return a unit quaternion that represents a rotation of an angle around an axis */ +D3DRMQUATERNION * WINAPI D3DRMQuaternionFromRotation(D3DRMQUATERNION *q, D3DVECTOR *v, D3DVALUE theta) +{ + q->s = cos(theta/2.0); + D3DRMVectorScale(&q->v, D3DRMVectorNormalize(v), sin(theta/2.0)); + return q; +} + +/* Interpolation between two quaternions */ +D3DRMQUATERNION * WINAPI D3DRMQuaternionSlerp(D3DRMQUATERNION *q, + D3DRMQUATERNION *a, D3DRMQUATERNION *b, D3DVALUE alpha) +{ + D3DVALUE dot, epsilon, temp, theta, u; + D3DVECTOR v1, v2; + + dot = a->s * b->s + D3DRMVectorDotProduct(&a->v, &b->v); + epsilon = 1.0f; + temp = 1.0f - alpha; + u = alpha; + if (dot < 0.0) + { + epsilon = -1.0; + dot = -dot; + } + if( 1.0f - dot > 0.001f ) + { + theta = acos(dot); + temp = sin(theta * temp) / sin(theta); + u = sin(theta * alpha) / sin(theta); + } + q->s = temp * a->s + epsilon * u * b->s; + D3DRMVectorScale(&v1, &a->v, temp); + D3DRMVectorScale(&v2, &b->v, epsilon * u); + D3DRMVectorAdd(&q->v, &v1, &v2); + return q; +} + +/* Add Two Vectors */ +D3DVECTOR * WINAPI D3DRMVectorAdd(D3DVECTOR *d, D3DVECTOR *s1, D3DVECTOR *s2) +{ + D3DVECTOR temp; + + temp.x=s1->x + s2->x; + temp.y=s1->y + s2->y; + temp.z=s1->z + s2->z; + + *d = temp; + return d; +} + +/* Subtract Two Vectors */ +D3DVECTOR * WINAPI D3DRMVectorSubtract(D3DVECTOR *d, D3DVECTOR *s1, D3DVECTOR *s2) +{ + D3DVECTOR temp; + + temp.x=s1->x - s2->x; + temp.y=s1->y - s2->y; + temp.z=s1->z - s2->z; + + *d = temp; + return d; +} + +/* Cross Product of Two Vectors */ +D3DVECTOR * WINAPI D3DRMVectorCrossProduct(D3DVECTOR *d, D3DVECTOR *s1, D3DVECTOR *s2) +{ + D3DVECTOR temp; + + temp.x=s1->y * s2->z - s1->z * s2->y; + temp.y=s1->z * s2->x - s1->x * s2->z; + temp.z=s1->x * s2->y - s1->y * s2->x; + + *d = temp; + return d; +} + +/* Dot Product of Two vectors */ +D3DVALUE WINAPI D3DRMVectorDotProduct(D3DVECTOR *s1, D3DVECTOR *s2) +{ + D3DVALUE dot_product; + dot_product=s1->x * s2->x + s1->y * s2->y + s1->z * s2->z; + return dot_product; +} + +/* Norm of a vector */ +D3DVALUE WINAPI D3DRMVectorModulus(D3DVECTOR *v) +{ + D3DVALUE result; + result=sqrt(v->x * v->x + v->y * v->y + v->z * v->z); + return result; +} + +/* Normalize a vector. Returns (1,0,0) if INPUT is the NULL vector. */ +D3DVECTOR * WINAPI D3DRMVectorNormalize(D3DVECTOR *u) +{ + D3DVALUE modulus = D3DRMVectorModulus(u); + if(modulus) + { + D3DRMVectorScale(u,u,1.0/modulus); + } + else + { + u->x=1.0; + u->y=0.0; + u->z=0.0; + } + return u; +} + +/* Returns a random unit vector */ +D3DVECTOR * WINAPI D3DRMVectorRandom(D3DVECTOR *d) +{ + d->x = rand(); + d->y = rand(); + d->z = rand(); + D3DRMVectorNormalize(d); + return d; +} + +/* Reflection of a vector on a surface */ +D3DVECTOR * WINAPI D3DRMVectorReflect(D3DVECTOR *r, D3DVECTOR *ray, D3DVECTOR *norm) +{ + D3DVECTOR sca, temp; + D3DRMVectorSubtract(&temp, D3DRMVectorScale(&sca, norm, 2.0*D3DRMVectorDotProduct(ray,norm)), ray); + + *r = temp; + return r; +} + +/* Rotation of a vector */ +D3DVECTOR * WINAPI D3DRMVectorRotate(D3DVECTOR *r, D3DVECTOR *v, D3DVECTOR *axis, D3DVALUE theta) +{ + D3DRMQUATERNION quaternion1, quaternion2, quaternion3; + D3DVECTOR norm; + + quaternion1.s = cos(theta * 0.5f); + quaternion2.s = cos(theta * 0.5f); + norm = *D3DRMVectorNormalize(axis); + D3DRMVectorScale(&quaternion1.v, &norm, sin(theta * 0.5f)); + D3DRMVectorScale(&quaternion2.v, &norm, -sin(theta * 0.5f)); + quaternion3.s = 0.0; + quaternion3.v = *v; + D3DRMQuaternionMultiply(&quaternion1, &quaternion1, &quaternion3); + D3DRMQuaternionMultiply(&quaternion1, &quaternion1, &quaternion2); + + *r = *D3DRMVectorNormalize(&quaternion1.v); + return r; +} + +/* Scale a vector */ +D3DVECTOR * WINAPI D3DRMVectorScale(D3DVECTOR *d, D3DVECTOR *s, D3DVALUE factor) +{ + D3DVECTOR temp; + + temp.x=factor * s->x; + temp.y=factor * s->y; + temp.z=factor * s->z; + + *d = temp; + return d; +} diff --git a/3rdparty/d3drm/meshbuilder.c b/3rdparty/d3drm/meshbuilder.c new file mode 100644 index 00000000..27e76c1c --- /dev/null +++ b/3rdparty/d3drm/meshbuilder.c @@ -0,0 +1,3040 @@ +/* + * Implementation of IDirect3DRMMeshBuilderX and IDirect3DRMMesh interfaces + * + * Copyright 2010, 2012 Christian Costa + * Copyright 2011 André Hentschel + * + * 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 + */ + +#include "d3drm_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d3drm); + +struct coords_2d +{ + D3DVALUE u; + D3DVALUE v; +}; + +struct mesh_material +{ + D3DCOLOR color; + IDirect3DRMMaterial2 *material; + IDirect3DRMTexture3 *texture; +}; + +char templates[] = { +"xof 0302txt 0064" +"template Header" +"{" +"<3D82AB43-62DA-11CF-AB39-0020AF71E433>" +"WORD major;" +"WORD minor;" +"DWORD flags;" +"}" +"template Vector" +"{" +"<3D82AB5E-62DA-11CF-AB39-0020AF71E433>" +"FLOAT x;" +"FLOAT y;" +"FLOAT z;" +"}" +"template Coords2d" +"{" +"" +"FLOAT u;" +"FLOAT v;" +"}" +"template Matrix4x4" +"{" +"" +"array FLOAT matrix[16];" +"}" +"template ColorRGBA" +"{" +"<35FF44E0-6C7C-11CF-8F52-0040333594A3>" +"FLOAT red;" +"FLOAT green;" +"FLOAT blue;" +"FLOAT alpha;" +"}" +"template ColorRGB" +"{" +"" +"FLOAT red;" +"FLOAT green;" +"FLOAT blue;" +"}" +"template IndexedColor" +"{" +"<1630B820-7842-11CF-8F52-0040333594A3>" +"DWORD index;" +"ColorRGBA indexColor;" +"}" +"template Boolean" +"{" +"<537DA6A0-CA37-11D0-941C-0080C80CFA7B>" +"DWORD truefalse;" +"}" +"template Boolean2d" +"{" +"<4885AE63-78E8-11CF-8F52-0040333594A3>" +"Boolean u;" +"Boolean v;" +"}" +"template MaterialWrap" +"{" +"<4885AE60-78E8-11CF-8F52-0040333594A3>" +"Boolean u;" +"Boolean v;" +"}" +"template TextureFilename" +"{" +"" +"STRING filename;" +"}" +"template Material" +"{" +"<3D82AB4D-62DA-11CF-AB39-0020AF71E433>" +"ColorRGBA faceColor;" +"FLOAT power;" +"ColorRGB specularColor;" +"ColorRGB emissiveColor;" +"[...]" +"}" +"template MeshFace" +"{" +"<3D82AB5F-62DA-11CF-AB39-0020AF71E433>" +"DWORD nFaceVertexIndices;" +"array DWORD faceVertexIndices[nFaceVertexIndices];" +"}" +"template MeshFaceWraps" +"{" +"" +"DWORD nFaceWrapValues;" +"array Boolean2d faceWrapValues[nFaceWrapValues];" +"}" +"template MeshTextureCoords" +"{" +"" +"DWORD nTextureCoords;" +"array Coords2d textureCoords[nTextureCoords];" +"}" +"template MeshMaterialList" +"{" +"" +"DWORD nMaterials;" +"DWORD nFaceIndexes;" +"array DWORD faceIndexes[nFaceIndexes];" +"[Material]" +"}" +"template MeshNormals" +"{" +"" +"DWORD nNormals;" +"array Vector normals[nNormals];" +"DWORD nFaceNormals;" +"array MeshFace faceNormals[nFaceNormals];" +"}" +"template MeshVertexColors" +"{" +"<1630B821-7842-11CF-8F52-0040333594A3>" +"DWORD nVertexColors;" +"array IndexedColor vertexColors[nVertexColors];" +"}" +"template Mesh" +"{" +"<3D82AB44-62DA-11CF-AB39-0020AF71E433>" +"DWORD nVertices;" +"array Vector vertices[nVertices];" +"DWORD nFaces;" +"array MeshFace faces[nFaces];" +"[...]" +"}" +"template FrameTransformMatrix" +"{" +"" +"Matrix4x4 frameMatrix;" +"}" +"template Frame" +"{" +"<3D82AB46-62DA-11CF-AB39-0020AF71E433>" +"[...]" +"}" +"template FloatKeys" +"{" +"<10DD46A9-775B-11CF-8F52-0040333594A3>" +"DWORD nValues;" +"array FLOAT values[nValues];" +"}" +"template TimedFloatKeys" +"{" +"" +"DWORD time;" +"FloatKeys tfkeys;" +"}" +"template AnimationKey" +"{" +"<10DD46A8-775B-11CF-8F52-0040333594A3>" +"DWORD keyType;" +"DWORD nKeys;" +"array TimedFloatKeys keys[nKeys];" +"}" +"template AnimationOptions" +"{" +"" +"DWORD openclosed;" +"DWORD positionquality;" +"}" +"template Animation" +"{" +"<3D82AB4F-62DA-11CF-AB39-0020AF71E433>" +"[...]" +"}" +"template AnimationSet" +"{" +"<3D82AB50-62DA-11CF-AB39-0020AF71E433>" +"[Animation]" +"}" +"template InlineData" +"{" +"<3A23EEA0-94B1-11D0-AB39-0020AF71E433>" +"[BINARY]" +"}" +"template Url" +"{" +"<3A23EEA1-94B1-11D0-AB39-0020AF71E433>" +"DWORD nUrls;" +"array STRING urls[nUrls];" +"}" +"template ProgressiveMesh" +"{" +"<8A63C360-997D-11D0-941C-0080C80CFA7B>" +"[Url,InlineData]" +"}" +"template Guid" +"{" +"" +"DWORD data1;" +"WORD data2;" +"WORD data3;" +"array UCHAR data4[8];" +"}" +"template StringProperty" +"{" +"<7F0F21E0-BFE1-11D1-82C0-00A0C9697271>" +"STRING key;" +"STRING value;" +"}" +"template PropertyBag" +"{" +"<7F0F21E1-BFE1-11D1-82C0-00A0C9697271>" +"[StringProperty]" +"}" +"template ExternalVisual" +"{" +"<98116AA0-BDBA-11D1-82C0-00A0C9697271>" +"Guid guidExternalVisual;" +"[...]" +"}" +"template RightHanded" +"{" +"<7F5D5EA0-D53A-11D1-82C0-00A0C9697271>" +"DWORD bRightHanded;" +"}" +}; + +BOOL d3drm_array_reserve(void **elements, SIZE_T *capacity, SIZE_T element_count, SIZE_T element_size) +{ + SIZE_T new_capacity, max_capacity; + void *new_elements; + + if (element_count <= *capacity) + return TRUE; + + max_capacity = ~(SIZE_T)0 / element_size; + if (max_capacity < element_count) + return FALSE; + + new_capacity = max(*capacity, 4); + while (new_capacity < element_count && new_capacity <= max_capacity / 2) + new_capacity *= 2; + + if (new_capacity < element_count) + new_capacity = max_capacity; + + if (!(new_elements = realloc(*elements, new_capacity * element_size))) + return FALSE; + + *elements = new_elements; + *capacity = new_capacity; + return TRUE; +} + +static inline struct d3drm_mesh *impl_from_IDirect3DRMMesh(IDirect3DRMMesh *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_mesh, IDirect3DRMMesh_iface); +} + +static inline struct d3drm_mesh_builder *impl_from_IDirect3DRMMeshBuilder2(IDirect3DRMMeshBuilder2 *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_mesh_builder, IDirect3DRMMeshBuilder2_iface); +} + +static inline struct d3drm_mesh_builder *impl_from_IDirect3DRMMeshBuilder3(IDirect3DRMMeshBuilder3 *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_mesh_builder, IDirect3DRMMeshBuilder3_iface); +} + +static inline struct d3drm_wrap *impl_from_IDirect3DRMWrap(IDirect3DRMWrap *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_wrap, IDirect3DRMWrap_iface); +} + +static void clean_mesh_builder_data(struct d3drm_mesh_builder *mesh_builder) +{ + DWORD i; + + IDirect3DRMMeshBuilder3_SetName(&mesh_builder->IDirect3DRMMeshBuilder3_iface, NULL); + free(mesh_builder->vertices); + mesh_builder->vertices = NULL; + mesh_builder->nb_vertices = 0; + mesh_builder->vertices_size = 0; + free(mesh_builder->normals); + mesh_builder->normals = NULL; + mesh_builder->nb_normals = 0; + mesh_builder->normals_size = 0; + free(mesh_builder->pFaceData); + mesh_builder->pFaceData = NULL; + mesh_builder->face_data_size = 0; + mesh_builder->nb_faces = 0; + free(mesh_builder->pCoords2d); + mesh_builder->pCoords2d = NULL; + mesh_builder->nb_coords2d = 0; + for (i = 0; i < mesh_builder->nb_materials; i++) + { + if (mesh_builder->materials[i].material) + IDirect3DRMMaterial2_Release(mesh_builder->materials[i].material); + if (mesh_builder->materials[i].texture) + IDirect3DRMTexture3_Release(mesh_builder->materials[i].texture); + } + mesh_builder->nb_materials = 0; + free(mesh_builder->materials); + mesh_builder->materials = NULL; + free(mesh_builder->material_indices); + mesh_builder->material_indices = NULL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_QueryInterface(IDirect3DRMMeshBuilder2 *iface, REFIID riid, void **out) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRMMeshBuilder2) + || IsEqualGUID(riid, &IID_IDirect3DRMMeshBuilder) + || IsEqualGUID(riid, &IID_IDirect3DRMVisual) + || IsEqualGUID(riid, &IID_IDirect3DRMObject) + || IsEqualGUID(riid, &IID_IUnknown)) + { + *out = &mesh_builder->IDirect3DRMMeshBuilder2_iface; + } + else if (IsEqualGUID(riid, &IID_IDirect3DRMMeshBuilder3)) + { + *out = &mesh_builder->IDirect3DRMMeshBuilder3_iface; + } + else + { + *out = NULL; + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} + +static ULONG WINAPI d3drm_mesh_builder2_AddRef(IDirect3DRMMeshBuilder2 *iface) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + ULONG refcount = InterlockedIncrement(&mesh_builder->ref); + + TRACE("%p increasing refcount to %lu.\n", mesh_builder, refcount); + + return refcount; +} + +static ULONG WINAPI d3drm_mesh_builder2_Release(IDirect3DRMMeshBuilder2 *iface) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + ULONG refcount = InterlockedDecrement(&mesh_builder->ref); + + TRACE("%p decreasing refcount to %lu.\n", mesh_builder, refcount); + + if (!refcount) + { + d3drm_object_cleanup((IDirect3DRMObject *)iface, &mesh_builder->obj); + clean_mesh_builder_data(mesh_builder); + if (mesh_builder->material) + IDirect3DRMMaterial2_Release(mesh_builder->material); + if (mesh_builder->texture) + IDirect3DRMTexture3_Release(mesh_builder->texture); + IDirect3DRM_Release(mesh_builder->d3drm); + free(mesh_builder); + } + + return refcount; +} + +static HRESULT WINAPI d3drm_mesh_builder2_Clone(IDirect3DRMMeshBuilder2 *iface, + IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_AddDestroyCallback(IDirect3DRMMeshBuilder2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return IDirect3DRMMeshBuilder3_AddDestroyCallback(&mesh_builder->IDirect3DRMMeshBuilder3_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_mesh_builder2_DeleteDestroyCallback(IDirect3DRMMeshBuilder2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return IDirect3DRMMeshBuilder3_DeleteDestroyCallback(&mesh_builder->IDirect3DRMMeshBuilder3_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetAppData(IDirect3DRMMeshBuilder3 *iface, DWORD data) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + mesh_builder->obj.appdata = data; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_builder2_SetAppData(IDirect3DRMMeshBuilder2 *iface, DWORD data) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + return d3drm_mesh_builder3_SetAppData(&mesh_builder->IDirect3DRMMeshBuilder3_iface, data); +} + +static DWORD WINAPI d3drm_mesh_builder3_GetAppData(IDirect3DRMMeshBuilder3 *iface) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p.\n", iface); + + return mesh_builder->obj.appdata; +} + +static DWORD WINAPI d3drm_mesh_builder2_GetAppData(IDirect3DRMMeshBuilder2 *iface) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_mesh_builder3_GetAppData(&mesh_builder->IDirect3DRMMeshBuilder3_iface); +} + +static HRESULT WINAPI d3drm_mesh_builder2_SetName(IDirect3DRMMeshBuilder2 *iface, const char *name) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return IDirect3DRMMeshBuilder3_SetName(&mesh_builder->IDirect3DRMMeshBuilder3_iface, name); +} + +static HRESULT WINAPI d3drm_mesh_builder2_GetName(IDirect3DRMMeshBuilder2 *iface, DWORD *size, char *name) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return IDirect3DRMMeshBuilder3_GetName(&mesh_builder->IDirect3DRMMeshBuilder3_iface, size, name); +} + +static HRESULT WINAPI d3drm_mesh_builder2_GetClassName(IDirect3DRMMeshBuilder2 *iface, DWORD *size, char *name) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return IDirect3DRMMeshBuilder3_GetClassName(&mesh_builder->IDirect3DRMMeshBuilder3_iface, size, name); +} + +static HRESULT WINAPI d3drm_mesh_builder2_Load(IDirect3DRMMeshBuilder2 *iface, void *filename, + void *name, D3DRMLOADOPTIONS flags, D3DRMLOADTEXTURECALLBACK cb, void *ctx) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, filename %p, name %p, flags %#lx, cb %p, ctx %p.\n", + iface, filename, name, flags, cb, ctx); + + if (cb) + FIXME("Texture callback is not yet supported\n"); + + return IDirect3DRMMeshBuilder3_Load(&mesh_builder->IDirect3DRMMeshBuilder3_iface, + filename, name, flags, NULL, ctx); +} + +static HRESULT WINAPI d3drm_mesh_builder2_Save(IDirect3DRMMeshBuilder2 *iface, + const char *filename, D3DRMXOFFORMAT format, D3DRMSAVEOPTIONS flags) +{ + FIXME("iface %p, filename %s, format %#x, flags %#lx stub!\n", + iface, debugstr_a(filename), format, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_Scale(IDirect3DRMMeshBuilder2 *iface, + D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, sx %.8e, sy %.8e, sz %.8e.\n", iface, sx, sy, sz); + + return IDirect3DRMMeshBuilder3_Scale(&mesh_builder->IDirect3DRMMeshBuilder3_iface, sx, sy, sz); +} + +static HRESULT WINAPI d3drm_mesh_builder2_Translate(IDirect3DRMMeshBuilder2 *iface, + D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) +{ + FIXME("iface %p, tx %.8e, ty %.8e, tz %.8e stub!\n", iface, tx, ty, tz); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_SetColorSource(IDirect3DRMMeshBuilder2 *iface, D3DRMCOLORSOURCE source) +{ + FIXME("iface %p, source %#x stub!\n", iface, source); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_GetBox(IDirect3DRMMeshBuilder2 *iface, D3DRMBOX *box) +{ + FIXME("iface %p, box %p stub!\n", iface, box); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_GenerateNormals(IDirect3DRMMeshBuilder2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static D3DRMCOLORSOURCE WINAPI d3drm_mesh_builder2_GetColorSource(IDirect3DRMMeshBuilder2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_AddMesh(IDirect3DRMMeshBuilder2 *iface, IDirect3DRMMesh *mesh) +{ + FIXME("iface %p, mesh %p stub!\n", iface, mesh); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_AddMeshBuilder(IDirect3DRMMeshBuilder2 *iface, + IDirect3DRMMeshBuilder *mesh_builder) +{ + FIXME("iface %p, mesh_builder %p stub!\n", iface, mesh_builder); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_AddFrame(IDirect3DRMMeshBuilder2 *iface, IDirect3DRMFrame *frame) +{ + FIXME("iface %p, frame %p stub!\n", iface, frame); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_AddFace(IDirect3DRMMeshBuilder2 *iface, IDirect3DRMFace *face) +{ + FIXME("iface %p, face %p stub!\n", iface, face); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_AddFaces(IDirect3DRMMeshBuilder2 *iface, + DWORD vertex_count, D3DVECTOR *vertices, DWORD normal_count, D3DVECTOR *normals, + DWORD *face_data, IDirect3DRMFaceArray **array) +{ + FIXME("iface %p, vertex_count %lu, vertices %p, normal_count %lu, normals %p, face_data %p, array %p stub!\n", + iface, vertex_count, vertices, normal_count, normals, face_data, array); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_ReserveSpace(IDirect3DRMMeshBuilder2 *iface, + DWORD vertex_count, DWORD normal_count, DWORD face_count) +{ + FIXME("iface %p, vertex_count %lu, normal_count %lu, face_count %lu stub!\n", + iface, vertex_count, normal_count, face_count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_SetColorRGB(IDirect3DRMMeshBuilder2 *iface, + D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue); + + return IDirect3DRMMeshBuilder3_SetColorRGB(&mesh_builder->IDirect3DRMMeshBuilder3_iface, red, green, blue); +} + +static HRESULT WINAPI d3drm_mesh_builder2_SetColor(IDirect3DRMMeshBuilder2 *iface, D3DCOLOR color) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, color 0x%08lx.\n", iface, color); + + return IDirect3DRMMeshBuilder3_SetColor(&mesh_builder->IDirect3DRMMeshBuilder3_iface, color); +} + +static HRESULT WINAPI d3drm_mesh_builder2_SetTexture(IDirect3DRMMeshBuilder2 *iface, + IDirect3DRMTexture *texture) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + IDirect3DRMTexture3 *texture3 = NULL; + HRESULT hr = D3DRM_OK; + + TRACE("iface %p, texture %p.\n", iface, texture); + + if (texture) + hr = IDirect3DRMTexture_QueryInterface(texture, &IID_IDirect3DRMTexture3, (void **)&texture3); + if (SUCCEEDED(hr)) + hr = IDirect3DRMMeshBuilder3_SetTexture(&mesh_builder->IDirect3DRMMeshBuilder3_iface, texture3); + if (texture3) + IDirect3DRMTexture3_Release(texture3); + + return hr; +} + +static HRESULT WINAPI d3drm_mesh_builder2_SetMaterial(IDirect3DRMMeshBuilder2 *iface, + IDirect3DRMMaterial *material) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, material %p.\n", iface, material); + + return IDirect3DRMMeshBuilder3_SetMaterial(&mesh_builder->IDirect3DRMMeshBuilder3_iface, + (IDirect3DRMMaterial2 *)material); +} + +static HRESULT WINAPI d3drm_mesh_builder2_SetTextureTopology(IDirect3DRMMeshBuilder2 *iface, + BOOL wrap_u, BOOL wrap_v) +{ + FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_SetQuality(IDirect3DRMMeshBuilder2 *iface, + D3DRMRENDERQUALITY quality) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + TRACE("iface %p, quality %#lx\n", iface, quality); + + return IDirect3DRMMeshBuilder3_SetQuality(&mesh_builder->IDirect3DRMMeshBuilder3_iface, quality); +} + +static HRESULT WINAPI d3drm_mesh_builder2_SetPerspective(IDirect3DRMMeshBuilder2 *iface, BOOL enable) +{ + FIXME("iface %p, enable %#x stub!\n", iface, enable); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_SetVertex(IDirect3DRMMeshBuilder2 *iface, + DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + FIXME("iface %p, index %lu, x %.8e, y %.8e, z %.8e stub!\n", iface, index, x, y, z); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_SetNormal(IDirect3DRMMeshBuilder2 *iface, + DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + FIXME("iface %p, index %lu, x %.8e, y %.8e, z %.8e stub!\n", iface, index, x, y, z); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_SetTextureCoordinates(IDirect3DRMMeshBuilder2 *iface, + DWORD index, D3DVALUE u, D3DVALUE v) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, index %lu, u %.8e, v %.8e.\n", iface, index, u, v); + + return IDirect3DRMMeshBuilder3_SetTextureCoordinates(&mesh_builder->IDirect3DRMMeshBuilder3_iface, + index, u, v); +} + +static HRESULT WINAPI d3drm_mesh_builder2_SetVertexColor(IDirect3DRMMeshBuilder2 *iface, + DWORD index, D3DCOLOR color) +{ + FIXME("iface %p, index %lu, color 0x%08lx stub!\n", iface, index, color); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_SetVertexColorRGB(IDirect3DRMMeshBuilder2 *iface, + DWORD index, D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + FIXME("iface %p, index %lu, red %.8e, green %.8e, blue %.8e stub!\n", + iface, index, red, green, blue); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_GetFaces(IDirect3DRMMeshBuilder2 *iface, + IDirect3DRMFaceArray **array) +{ + FIXME("iface %p, array %p stub!\n", iface, array); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_GetVertices(IDirect3DRMMeshBuilder2 *iface, + DWORD *vertex_count, D3DVECTOR *vertices, DWORD *normal_count, D3DVECTOR *normals, + DWORD *face_data_size, DWORD *face_data) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, vertex_count %p, vertices %p, normal_count %p, normals %p, face_data_size %p, face_data %p.\n", + iface, vertex_count, vertices, normal_count, normals, face_data_size, face_data); + + if (vertices && (!vertex_count || (*vertex_count < mesh_builder->nb_vertices))) + return D3DRMERR_BADVALUE; + if (vertex_count) + *vertex_count = mesh_builder->nb_vertices; + if (vertices && mesh_builder->nb_vertices) + memcpy(vertices, mesh_builder->vertices, mesh_builder->nb_vertices * sizeof(*vertices)); + + if (normals && (!normal_count || (*normal_count < mesh_builder->nb_normals))) + return D3DRMERR_BADVALUE; + if (normal_count) + *normal_count = mesh_builder->nb_normals; + if (normals && mesh_builder->nb_normals) + memcpy(normals, mesh_builder->normals, mesh_builder->nb_normals * sizeof(*normals)); + + if (face_data && (!face_data_size || (*face_data_size < mesh_builder->face_data_size))) + return D3DRMERR_BADVALUE; + if (face_data_size) + *face_data_size = mesh_builder->face_data_size; + if (face_data && mesh_builder->face_data_size) + memcpy(face_data, mesh_builder->pFaceData, mesh_builder->face_data_size * sizeof(*face_data)); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_builder2_GetTextureCoordinates(IDirect3DRMMeshBuilder2 *iface, + DWORD index, D3DVALUE *u, D3DVALUE *v) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, index %lu, u %p, v %p.\n", iface, index, u, v); + + return IDirect3DRMMeshBuilder3_GetTextureCoordinates(&mesh_builder->IDirect3DRMMeshBuilder3_iface, + index, u, v); +} + +static int WINAPI d3drm_mesh_builder2_AddVertex(IDirect3DRMMeshBuilder2 *iface, + D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, x %.8e, y %.8e, z %.8e.\n", iface, x, y, z); + + return IDirect3DRMMeshBuilder3_AddVertex(&mesh_builder->IDirect3DRMMeshBuilder3_iface, x, y, z); +} + +static int WINAPI d3drm_mesh_builder2_AddNormal(IDirect3DRMMeshBuilder2 *iface, + D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, x %.8e, y %.8e, z %.8e.\n", iface, x, y, z); + + return IDirect3DRMMeshBuilder3_AddNormal(&mesh_builder->IDirect3DRMMeshBuilder3_iface, x, y, z); +} + +static HRESULT WINAPI d3drm_mesh_builder2_CreateFace(IDirect3DRMMeshBuilder2 *iface, IDirect3DRMFace **face) +{ + struct d3drm_face *object; + HRESULT hr; + + TRACE("iface %p, face %p.\n", iface, face); + + if (FAILED(hr = d3drm_face_create(&object))) + return hr; + + *face = &object->IDirect3DRMFace_iface; + + return S_OK; +} + +static D3DRMRENDERQUALITY WINAPI d3drm_mesh_builder2_GetQuality(IDirect3DRMMeshBuilder2 *iface) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p\n", iface); + + return mesh_builder->quality; +} + +static BOOL WINAPI d3drm_mesh_builder2_GetPerspective(IDirect3DRMMeshBuilder2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return FALSE; +} + +static int WINAPI d3drm_mesh_builder2_GetFaceCount(IDirect3DRMMeshBuilder2 *iface) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p.\n", iface); + + return mesh_builder->nb_faces; +} + +static int WINAPI d3drm_mesh_builder2_GetVertexCount(IDirect3DRMMeshBuilder2 *iface) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p.\n", iface); + + return mesh_builder->nb_vertices; +} + +static D3DCOLOR WINAPI d3drm_mesh_builder2_GetVertexColor(IDirect3DRMMeshBuilder2 *iface, DWORD index) +{ + FIXME("iface %p, index %lu stub!\n", iface, index); + + return 0; +} + +static HRESULT WINAPI d3drm_mesh_builder2_CreateMesh(IDirect3DRMMeshBuilder2 *iface, IDirect3DRMMesh **mesh) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + + TRACE("iface %p, mesh %p.\n", iface, mesh); + + return IDirect3DRMMeshBuilder3_CreateMesh(&mesh_builder->IDirect3DRMMeshBuilder3_iface, mesh); +} + +static HRESULT WINAPI d3drm_mesh_builder2_GenerateNormals2(IDirect3DRMMeshBuilder2 *iface, + D3DVALUE crease, DWORD flags) +{ + FIXME("iface %p, crease %.8e, flags %#lx stub!\n", iface, crease, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder2_GetFace(IDirect3DRMMeshBuilder2 *iface, + DWORD index, IDirect3DRMFace **face) +{ + FIXME("iface %p, index %lu, face %p stub!\n", iface, index, face); + + return E_NOTIMPL; +} + +static const struct IDirect3DRMMeshBuilder2Vtbl d3drm_mesh_builder2_vtbl = +{ + d3drm_mesh_builder2_QueryInterface, + d3drm_mesh_builder2_AddRef, + d3drm_mesh_builder2_Release, + d3drm_mesh_builder2_Clone, + d3drm_mesh_builder2_AddDestroyCallback, + d3drm_mesh_builder2_DeleteDestroyCallback, + d3drm_mesh_builder2_SetAppData, + d3drm_mesh_builder2_GetAppData, + d3drm_mesh_builder2_SetName, + d3drm_mesh_builder2_GetName, + d3drm_mesh_builder2_GetClassName, + d3drm_mesh_builder2_Load, + d3drm_mesh_builder2_Save, + d3drm_mesh_builder2_Scale, + d3drm_mesh_builder2_Translate, + d3drm_mesh_builder2_SetColorSource, + d3drm_mesh_builder2_GetBox, + d3drm_mesh_builder2_GenerateNormals, + d3drm_mesh_builder2_GetColorSource, + d3drm_mesh_builder2_AddMesh, + d3drm_mesh_builder2_AddMeshBuilder, + d3drm_mesh_builder2_AddFrame, + d3drm_mesh_builder2_AddFace, + d3drm_mesh_builder2_AddFaces, + d3drm_mesh_builder2_ReserveSpace, + d3drm_mesh_builder2_SetColorRGB, + d3drm_mesh_builder2_SetColor, + d3drm_mesh_builder2_SetTexture, + d3drm_mesh_builder2_SetMaterial, + d3drm_mesh_builder2_SetTextureTopology, + d3drm_mesh_builder2_SetQuality, + d3drm_mesh_builder2_SetPerspective, + d3drm_mesh_builder2_SetVertex, + d3drm_mesh_builder2_SetNormal, + d3drm_mesh_builder2_SetTextureCoordinates, + d3drm_mesh_builder2_SetVertexColor, + d3drm_mesh_builder2_SetVertexColorRGB, + d3drm_mesh_builder2_GetFaces, + d3drm_mesh_builder2_GetVertices, + d3drm_mesh_builder2_GetTextureCoordinates, + d3drm_mesh_builder2_AddVertex, + d3drm_mesh_builder2_AddNormal, + d3drm_mesh_builder2_CreateFace, + d3drm_mesh_builder2_GetQuality, + d3drm_mesh_builder2_GetPerspective, + d3drm_mesh_builder2_GetFaceCount, + d3drm_mesh_builder2_GetVertexCount, + d3drm_mesh_builder2_GetVertexColor, + d3drm_mesh_builder2_CreateMesh, + d3drm_mesh_builder2_GenerateNormals2, + d3drm_mesh_builder2_GetFace, +}; + +static HRESULT WINAPI d3drm_mesh_builder3_QueryInterface(IDirect3DRMMeshBuilder3 *iface, REFIID riid, void **out) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + return d3drm_mesh_builder2_QueryInterface(&mesh_builder->IDirect3DRMMeshBuilder2_iface, riid, out); +} + +static ULONG WINAPI d3drm_mesh_builder3_AddRef(IDirect3DRMMeshBuilder3 *iface) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_mesh_builder2_AddRef(&mesh_builder->IDirect3DRMMeshBuilder2_iface); +} + +static ULONG WINAPI d3drm_mesh_builder3_Release(IDirect3DRMMeshBuilder3 *iface) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_mesh_builder2_Release(&mesh_builder->IDirect3DRMMeshBuilder2_iface); +} + +static HRESULT WINAPI d3drm_mesh_builder3_Clone(IDirect3DRMMeshBuilder3 *iface, + IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_AddDestroyCallback(IDirect3DRMMeshBuilder3 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_add_destroy_callback(&mesh_builder->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_mesh_builder3_DeleteDestroyCallback(IDirect3DRMMeshBuilder3 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_delete_destroy_callback(&mesh_builder->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetName(IDirect3DRMMeshBuilder3 *iface, const char *name) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_object_set_name(&mesh_builder->obj, name); +} + +static HRESULT WINAPI d3drm_mesh_builder3_GetName(IDirect3DRMMeshBuilder3 *iface, + DWORD *size, char *name) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_name(&mesh_builder->obj, size, name); +} + +static HRESULT WINAPI d3drm_mesh_builder3_GetClassName(IDirect3DRMMeshBuilder3 *iface, + DWORD *size, char *name) +{ + struct d3drm_mesh_builder *meshbuilder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_class_name(&meshbuilder->obj, size, name); +} + +HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData, + D3DRMLOADTEXTURECALLBACK load_texture_proc, void *arg) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + IDirectXFileData *pData2 = NULL; + const GUID* guid; + DWORD size; + BYTE *ptr; + HRESULT hr; + HRESULT ret = D3DRMERR_BADOBJECT; + DWORD* faces_vertex_idx_data = NULL; + DWORD* faces_vertex_idx_ptr; + DWORD faces_vertex_idx_size; + DWORD* faces_normal_idx_data = NULL; + DWORD* faces_normal_idx_ptr = NULL; + DWORD* faces_data_ptr; + DWORD faces_data_size = 0; + DWORD i; + + TRACE("(%p)->(%p)\n", mesh_builder, pData); + + hr = IDirectXFileData_GetName(pData, NULL, &size); + if (hr != DXFILE_OK) + return hr; + if (size) + { + char *name; + + if (!(name = malloc(size))) + return E_OUTOFMEMORY; + + if (SUCCEEDED(hr = IDirectXFileData_GetName(pData, name, &size))) + IDirect3DRMMeshBuilder3_SetName(iface, name); + free(name); + if (hr != DXFILE_OK) + return hr; + } + + TRACE("Mesh name is %s\n", debugstr_a(mesh_builder->obj.name)); + + mesh_builder->nb_normals = 0; + + hr = IDirectXFileData_GetData(pData, NULL, &size, (void**)&ptr); + if (hr != DXFILE_OK) + goto end; + + mesh_builder->nb_vertices = *(DWORD*)ptr; + mesh_builder->nb_faces = *(DWORD*)(ptr + sizeof(DWORD) + mesh_builder->nb_vertices * sizeof(D3DVECTOR)); + faces_vertex_idx_size = size - sizeof(DWORD) - mesh_builder->nb_vertices * sizeof(D3DVECTOR) - sizeof(DWORD); + + TRACE("Mesh: nb_vertices = %Iu, nb_faces = %ld, faces_vertex_idx_size = %ld\n", mesh_builder->nb_vertices, + mesh_builder->nb_faces, faces_vertex_idx_size); + + if (!d3drm_array_reserve((void **)&mesh_builder->vertices, &mesh_builder->vertices_size, mesh_builder->nb_vertices, + sizeof(*mesh_builder->vertices))) + { + hr = E_OUTOFMEMORY; + goto end; + } + memcpy(mesh_builder->vertices, ptr + sizeof(DWORD), mesh_builder->nb_vertices * sizeof(D3DVECTOR)); + + faces_vertex_idx_ptr = faces_vertex_idx_data = malloc(faces_vertex_idx_size); + memcpy(faces_vertex_idx_data, ptr + sizeof(DWORD) + mesh_builder->nb_vertices * sizeof(D3DVECTOR) + sizeof(DWORD), + faces_vertex_idx_size); + + /* Each vertex index will have its normal index counterpart so just allocate twice the size */ + mesh_builder->pFaceData = malloc(faces_vertex_idx_size * 2); + faces_data_ptr = (DWORD*)mesh_builder->pFaceData; + + while (1) + { + IDirectXFileObject *object; + + hr = IDirectXFileData_GetNextObject(pData, &object); + if (hr == DXFILEERR_NOMOREOBJECTS) + { + TRACE("No more object\n"); + break; + } + if (hr != DXFILE_OK) + goto end; + + hr = IDirectXFileObject_QueryInterface(object, &IID_IDirectXFileData, (void**)&pData2); + IDirectXFileObject_Release(object); + if (hr != DXFILE_OK) + goto end; + + hr = IDirectXFileData_GetType(pData2, &guid); + if (hr != DXFILE_OK) + goto end; + + TRACE("Found object type whose GUID = %s\n", debugstr_guid(guid)); + + if (IsEqualGUID(guid, &TID_D3DRMMeshNormals)) + { + DWORD nb_faces_normals; + DWORD faces_normal_idx_size; + + hr = IDirectXFileData_GetData(pData2, NULL, &size, (void**)&ptr); + if (hr != DXFILE_OK) + goto end; + + mesh_builder->nb_normals = *(DWORD*)ptr; + nb_faces_normals = *(DWORD*)(ptr + sizeof(DWORD) + mesh_builder->nb_normals * sizeof(D3DVECTOR)); + + TRACE("MeshNormals: nb_normals = %Iu, nb_faces_normals = %ld\n", mesh_builder->nb_normals, nb_faces_normals); + if (nb_faces_normals != mesh_builder->nb_faces) + WARN("nb_face_normals (%ld) != nb_faces (%ld)\n", nb_faces_normals, mesh_builder->nb_faces); + + if (!d3drm_array_reserve((void **)&mesh_builder->normals, &mesh_builder->normals_size, + mesh_builder->nb_normals, sizeof(*mesh_builder->normals))) + { + hr = E_OUTOFMEMORY; + goto end; + } + memcpy(mesh_builder->normals, ptr + sizeof(DWORD), mesh_builder->nb_normals * sizeof(D3DVECTOR)); + + faces_normal_idx_size = size - (2 * sizeof(DWORD) + mesh_builder->nb_normals * sizeof(D3DVECTOR)); + faces_normal_idx_ptr = faces_normal_idx_data = malloc(faces_normal_idx_size); + memcpy(faces_normal_idx_data, ptr + sizeof(DWORD) + mesh_builder->nb_normals * sizeof(D3DVECTOR) + + sizeof(DWORD), faces_normal_idx_size); + } + else if (IsEqualGUID(guid, &TID_D3DRMMeshTextureCoords)) + { + hr = IDirectXFileData_GetData(pData2, NULL, &size, (void**)&ptr); + if (hr != DXFILE_OK) + goto end; + + mesh_builder->nb_coords2d = *(DWORD*)ptr; + + TRACE("MeshTextureCoords: nb_coords2d = %ld\n", mesh_builder->nb_coords2d); + + mesh_builder->pCoords2d = calloc(mesh_builder->nb_coords2d, sizeof(*mesh_builder->pCoords2d)); + memcpy(mesh_builder->pCoords2d, ptr + sizeof(DWORD), mesh_builder->nb_coords2d * sizeof(*mesh_builder->pCoords2d)); + } + else if (IsEqualGUID(guid, &TID_D3DRMMeshMaterialList)) + { + DWORD nb_materials; + DWORD nb_face_indices; + DWORD data_size; + IDirectXFileObject *child; + DWORD i = 0; + float* values; + struct d3drm_texture *texture_object; + + TRACE("Process MeshMaterialList\n"); + + hr = IDirectXFileData_GetData(pData2, NULL, &size, (void**)&ptr); + if (hr != DXFILE_OK) + goto end; + + nb_materials = *(DWORD*)ptr; + nb_face_indices = *(DWORD*)(ptr + sizeof(DWORD)); + data_size = 2 * sizeof(DWORD) + nb_face_indices * sizeof(DWORD); + + TRACE("nMaterials = %lu, nFaceIndexes = %lu\n", nb_materials, nb_face_indices); + + if (size != data_size) + WARN("Returned size %lu does not match expected one %lu\n", size, data_size); + + if (!(mesh_builder->material_indices = calloc(nb_face_indices, + sizeof(*mesh_builder->material_indices)))) + goto end; + memcpy(mesh_builder->material_indices, ptr + 2 * sizeof(DWORD), + nb_face_indices * sizeof(*mesh_builder->material_indices)); + + if (!(mesh_builder->materials = calloc(nb_materials, sizeof(*mesh_builder->materials)))) + { + free(mesh_builder->material_indices); + goto end; + } + mesh_builder->nb_materials = nb_materials; + + while (SUCCEEDED(hr = IDirectXFileData_GetNextObject(pData2, &child)) && (i < nb_materials)) + { + IDirectXFileData *data; + IDirectXFileDataReference *reference; + IDirectXFileObject *material_child; + struct d3drm_material *object; + + hr = IDirectXFileObject_QueryInterface(child, &IID_IDirectXFileData, (void **)&data); + if (FAILED(hr)) + { + hr = IDirectXFileObject_QueryInterface(child, &IID_IDirectXFileDataReference, (void **)&reference); + IDirectXFileObject_Release(child); + if (FAILED(hr)) + goto end; + + hr = IDirectXFileDataReference_Resolve(reference, &data); + IDirectXFileDataReference_Release(reference); + if (FAILED(hr)) + goto end; + } + else + { + IDirectXFileObject_Release(child); + } + + hr = d3drm_material_create(&object, mesh_builder->d3drm); + if (FAILED(hr)) + { + IDirectXFileData_Release(data); + goto end; + } + mesh_builder->materials[i].material = &object->IDirect3DRMMaterial2_iface; + + hr = IDirectXFileData_GetData(data, NULL, &size, (void**)&ptr); + if (hr != DXFILE_OK) + { + IDirectXFileData_Release(data); + goto end; + } + + if (size != 44) + WARN("Material size %lu does not match expected one %u\n", size, 44); + + values = (float*)ptr; + + d3drm_set_color(&mesh_builder->materials[i].color, values[0], values[1], values[2], values[3]); + + IDirect3DRMMaterial2_SetAmbient(mesh_builder->materials[i].material, values[0], values [1], values[2]); /* Alpha ignored */ + IDirect3DRMMaterial2_SetPower(mesh_builder->materials[i].material, values[4]); + IDirect3DRMMaterial2_SetSpecular(mesh_builder->materials[i].material, values[5], values[6], values[7]); + IDirect3DRMMaterial2_SetEmissive(mesh_builder->materials[i].material, values[8], values[9], values[10]); + + mesh_builder->materials[i].texture = NULL; + + hr = IDirectXFileData_GetNextObject(data, &material_child); + if (hr == S_OK) + { + IDirectXFileData *data; + char **filename; + + if (FAILED(hr = IDirectXFileObject_QueryInterface(material_child, + &IID_IDirectXFileData, (void **)&data))) + { + IDirectXFileDataReference *reference; + + if (SUCCEEDED(IDirectXFileObject_QueryInterface(material_child, + &IID_IDirectXFileDataReference, (void **)&reference))) + { + hr = IDirectXFileDataReference_Resolve(reference, &data); + IDirectXFileDataReference_Release(reference); + } + } + IDirectXFileObject_Release(material_child); + if (FAILED(hr)) + goto end; + + hr = IDirectXFileData_GetType(data, &guid); + if (hr != DXFILE_OK) + goto end; + if (!IsEqualGUID(guid, &TID_D3DRMTextureFilename)) + { + WARN("Not a texture filename\n"); + goto end; + } + + size = 4; + hr = IDirectXFileData_GetData(data, NULL, &size, (void**)&filename); + if (SUCCEEDED(hr)) + { + if (load_texture_proc) + { + IDirect3DRMTexture *texture; + + hr = load_texture_proc(*filename, arg, &texture); + if (SUCCEEDED(hr)) + { + hr = IDirect3DTexture_QueryInterface(texture, &IID_IDirect3DRMTexture3, + (void **)&mesh_builder->materials[i].texture); + IDirect3DTexture_Release(texture); + } + } + else + { + HANDLE file; + + /* If the texture file is not found, no texture is associated with the material */ + file = CreateFileA(*filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + if (file != INVALID_HANDLE_VALUE) + { + CloseHandle(file); + if (FAILED(hr = d3drm_texture_create(&texture_object, NULL))) + { + IDirectXFileData_Release(data); + goto end; + } + mesh_builder->materials[i].texture = &texture_object->IDirect3DRMTexture3_iface; + } + } + } + IDirectXFileData_Release(data); + } + else if (hr != DXFILEERR_NOMOREOBJECTS) + { + goto end; + } + hr = S_OK; + + IDirectXFileData_Release(data); + i++; + } + if (hr == S_OK) + { + IDirectXFileObject_Release(child); + WARN("Found more sub-objects than expected\n"); + } + else if (hr != DXFILEERR_NOMOREOBJECTS) + { + goto end; + } + hr = S_OK; + } + else + { + FIXME("Unknown GUID %s, ignoring...\n", debugstr_guid(guid)); + } + + IDirectXFileData_Release(pData2); + pData2 = NULL; + } + + if (!mesh_builder->nb_normals) + { + /* Allocate normals, one per vertex */ + if (!d3drm_array_reserve((void **)&mesh_builder->normals, &mesh_builder->normals_size, + mesh_builder->nb_vertices, sizeof(*mesh_builder->normals))) + goto end; + memset(mesh_builder->normals, 0, mesh_builder->nb_vertices * sizeof(*mesh_builder->normals)); + } + + for (i = 0; i < mesh_builder->nb_faces; i++) + { + DWORD j; + DWORD nb_face_indexes; + D3DVECTOR face_normal; + + if (faces_vertex_idx_size < sizeof(DWORD)) + WARN("Not enough data to read number of indices of face %ld\n", i); + + nb_face_indexes = *(faces_data_ptr + faces_data_size++) = *(faces_vertex_idx_ptr++); + faces_vertex_idx_size--; + if (faces_normal_idx_data && (*(faces_normal_idx_ptr++) != nb_face_indexes)) + WARN("Faces indices number mismatch\n"); + + if (faces_vertex_idx_size < (nb_face_indexes * sizeof(DWORD))) + WARN("Not enough data to read all indices of face %ld\n", i); + + if (!mesh_builder->nb_normals) + { + /* Compute face normal */ + if (nb_face_indexes > 2 + && faces_vertex_idx_ptr[0] < mesh_builder->nb_vertices + && faces_vertex_idx_ptr[1] < mesh_builder->nb_vertices + && faces_vertex_idx_ptr[2] < mesh_builder->nb_vertices) + { + D3DVECTOR a, b; + + D3DRMVectorSubtract(&a, &mesh_builder->vertices[faces_vertex_idx_ptr[2]], &mesh_builder->vertices[faces_vertex_idx_ptr[1]]); + D3DRMVectorSubtract(&b, &mesh_builder->vertices[faces_vertex_idx_ptr[0]], &mesh_builder->vertices[faces_vertex_idx_ptr[1]]); + D3DRMVectorCrossProduct(&face_normal, &a, &b); + D3DRMVectorNormalize(&face_normal); + } + else + { + face_normal.x = 0.0f; + face_normal.y = 0.0f; + face_normal.z = 0.0f; + } + } + + for (j = 0; j < nb_face_indexes; j++) + { + /* Copy vertex index */ + *(faces_data_ptr + faces_data_size++) = *faces_vertex_idx_ptr; + /* Copy normal index */ + if (mesh_builder->nb_normals) + { + /* Read from x file */ + *(faces_data_ptr + faces_data_size++) = *(faces_normal_idx_ptr++); + } + else + { + DWORD vertex_idx = *faces_vertex_idx_ptr; + if (vertex_idx >= mesh_builder->nb_vertices) + { + WARN("Found vertex index %lu but only %Iu vertices available => use index 0\n", vertex_idx, + mesh_builder->nb_vertices); + vertex_idx = 0; + } + *(faces_data_ptr + faces_data_size++) = vertex_idx; + /* Add face normal to vertex normal */ + D3DRMVectorAdd(&mesh_builder->normals[vertex_idx], &mesh_builder->normals[vertex_idx], &face_normal); + } + faces_vertex_idx_ptr++; + } + faces_vertex_idx_size -= nb_face_indexes; + } + + /* Last DWORD must be 0 */ + *(faces_data_ptr + faces_data_size++) = 0; + + /* Set size (in number of DWORD) of all faces data */ + mesh_builder->face_data_size = faces_data_size; + + if (!mesh_builder->nb_normals) + { + /* Normalize all normals */ + for (i = 0; i < mesh_builder->nb_vertices; i++) + { + D3DRMVectorNormalize(&mesh_builder->normals[i]); + } + mesh_builder->nb_normals = mesh_builder->nb_vertices; + } + + /* If there is no texture coordinates, generate default texture coordinates (0.0f, 0.0f) for each vertex */ + if (!mesh_builder->pCoords2d) + { + mesh_builder->nb_coords2d = mesh_builder->nb_vertices; + mesh_builder->pCoords2d = calloc(mesh_builder->nb_coords2d, sizeof(*mesh_builder->pCoords2d)); + for (i = 0; i < mesh_builder->nb_coords2d; ++i) + { + mesh_builder->pCoords2d[i].u = 0.0f; + mesh_builder->pCoords2d[i].v = 0.0f; + } + } + + TRACE("Mesh data loaded successfully\n"); + + ret = D3DRM_OK; + +end: + + free(faces_normal_idx_data); + free(faces_vertex_idx_data); + + return ret; +} + +static HRESULT WINAPI d3drm_mesh_builder3_Load(IDirect3DRMMeshBuilder3 *iface, void *filename, + void *name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURE3CALLBACK cb, void *arg) +{ + static const DWORD supported_flags = D3DRMLOAD_FROMFILE | D3DRMLOAD_FROMRESOURCE + | D3DRMLOAD_FROMMEMORY | D3DRMLOAD_FROMSTREAM | D3DRMLOAD_FROMURL; + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + DXFILELOADOPTIONS load_options = loadflags & supported_flags; + IDirectXFile *dxfile = NULL; + IDirectXFileEnumObject *enum_object = NULL; + IDirectXFileData *data = NULL; + const GUID* guid; + DWORD size; + struct d3drm_file_header *header; + HRESULT hr; + HRESULT ret = D3DRMERR_BADOBJECT; + + TRACE("iface %p, filename %p, name %p, loadflags %#lx, cb %p, arg %p.\n", + iface, filename, name, loadflags, cb, arg); + + if (loadflags & ~supported_flags) + FIXME("Ignoring flags %#lx.\n", loadflags & ~supported_flags); + + clean_mesh_builder_data(mesh_builder); + + hr = DirectXFileCreate(&dxfile); + if (hr != DXFILE_OK) + goto end; + + hr = IDirectXFile_RegisterTemplates(dxfile, templates, strlen(templates)); + if (hr != DXFILE_OK) + goto end; + + hr = IDirectXFile_CreateEnumObject(dxfile, filename, load_options, &enum_object); + if (hr != DXFILE_OK) + { + WARN("Failed to create object, load flags %#lx.\n", loadflags); + goto end; + } + + hr = IDirectXFileEnumObject_GetNextDataObject(enum_object, &data); + if (hr != DXFILE_OK) + goto end; + + hr = IDirectXFileData_GetType(data, &guid); + if (hr != DXFILE_OK) + goto end; + + TRACE("Found object type whose GUID = %s\n", debugstr_guid(guid)); + + if (!IsEqualGUID(guid, &TID_DXFILEHeader)) + { + ret = D3DRMERR_BADFILE; + goto end; + } + + hr = IDirectXFileData_GetData(data, NULL, &size, (void**)&header); + if ((hr != DXFILE_OK) || (size != sizeof(*header))) + goto end; + + TRACE("Version is %u.%u, flags %#lx.\n", header->major, header->minor, header->flags); + + /* Version must be 1.0.x */ + if ((header->major != 1) || (header->minor != 0)) + { + ret = D3DRMERR_BADFILE; + goto end; + } + + IDirectXFileData_Release(data); + data = NULL; + + hr = IDirectXFileEnumObject_GetNextDataObject(enum_object, &data); + if (hr != DXFILE_OK) + { + ret = D3DRMERR_NOTFOUND; + goto end; + } + + hr = IDirectXFileData_GetType(data, &guid); + if (hr != DXFILE_OK) + goto end; + + TRACE("Found object type whose GUID = %s\n", debugstr_guid(guid)); + + if (!IsEqualGUID(guid, &TID_D3DRMMesh)) + { + ret = D3DRMERR_NOTFOUND; + goto end; + } + + /* We don't care about the texture interface version since we rely on QueryInterface */ + hr = load_mesh_data(iface, data, (D3DRMLOADTEXTURECALLBACK)cb, arg); + if (hr == S_OK) + ret = D3DRM_OK; + +end: + + if (data) + IDirectXFileData_Release(data); + if (enum_object) + IDirectXFileEnumObject_Release(enum_object); + if (dxfile) + IDirectXFile_Release(dxfile); + + if (ret != D3DRM_OK) + clean_mesh_builder_data(mesh_builder); + + return ret; +} + +static HRESULT WINAPI d3drm_mesh_builder3_Save(IDirect3DRMMeshBuilder3 *iface, + const char *filename, D3DRMXOFFORMAT format, D3DRMSAVEOPTIONS flags) +{ + FIXME("iface %p, filename %s, format %#x, flags %#lx stub!\n", + iface, debugstr_a(filename), format, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_Scale(IDirect3DRMMeshBuilder3 *iface, + D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + DWORD i; + + TRACE("iface %p, sx %.8e, sy %.8e, sz %.8e.\n", iface, sx, sy, sz); + + for (i = 0; i < mesh_builder->nb_vertices; ++i) + { + mesh_builder->vertices[i].x *= sx; + mesh_builder->vertices[i].y *= sy; + mesh_builder->vertices[i].z *= sz; + } + + /* Normals are not affected by Scale */ + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_builder3_Translate(IDirect3DRMMeshBuilder3 *iface, + D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) +{ + FIXME("iface %p, tx %.8e, ty %.8e, tz %.8e stub!\n", iface, tx, ty, tz); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetColorSource(IDirect3DRMMeshBuilder3 *iface, + D3DRMCOLORSOURCE source) +{ + FIXME("iface %p, source %#x stub!\n", iface, source); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_GetBox(IDirect3DRMMeshBuilder3 *iface, D3DRMBOX *box) +{ + FIXME("iface %p, box %p stub!\n", iface, box); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_GenerateNormals(IDirect3DRMMeshBuilder3 *iface, + D3DVALUE crease, DWORD flags) +{ + FIXME("iface %p, crease %.8e, flags %#lx stub!\n", iface, crease, flags); + + return E_NOTIMPL; +} + +static D3DRMCOLORSOURCE WINAPI d3drm_mesh_builder3_GetColorSource(IDirect3DRMMeshBuilder3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_AddMesh(IDirect3DRMMeshBuilder3 *iface, IDirect3DRMMesh *mesh) +{ + FIXME("iface %p, mesh %p stub!\n", iface, mesh); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_AddMeshBuilder(IDirect3DRMMeshBuilder3 *iface, + IDirect3DRMMeshBuilder3 *mesh_builder, DWORD flags) +{ + FIXME("iface %p, mesh_builder %p, flags %#lx stub!\n", iface, mesh_builder, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_AddFrame(IDirect3DRMMeshBuilder3 *iface, IDirect3DRMFrame3 *frame) +{ + FIXME("iface %p, frame %p stub!\n", iface, frame); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_AddFace(IDirect3DRMMeshBuilder3 *iface, IDirect3DRMFace2 *face) +{ + FIXME("iface %p, face %p stub!\n", iface, face); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_AddFaces(IDirect3DRMMeshBuilder3 *iface, + DWORD vertex_count, D3DVECTOR *vertices, DWORD normal_count, D3DVECTOR *normals, + DWORD *face_data, IDirect3DRMFaceArray **array) +{ + FIXME("iface %p, vertex_count %lu, vertices %p, normal_count %lu, normals %p, face_data %p array %p stub!\n", + iface, vertex_count, vertices, normal_count, normals, face_data, array); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_ReserveSpace(IDirect3DRMMeshBuilder3 *iface, + DWORD vertex_count, DWORD normal_count, DWORD face_count) +{ + FIXME("iface %p, vertex_count %lu, normal_count %lu, face_count %lu stub!\n", + iface, vertex_count, normal_count, face_count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetColorRGB(IDirect3DRMMeshBuilder3 *iface, + D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue); + + d3drm_set_color(&mesh_builder->color, red, green, blue, 1.0f); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetColor(IDirect3DRMMeshBuilder3 *iface, D3DCOLOR color) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, color 0x%08lx.\n", iface, color); + + mesh_builder->color = color; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetTexture(IDirect3DRMMeshBuilder3 *iface, + IDirect3DRMTexture3 *texture) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, texture %p.\n", iface, texture); + + if (texture) + IDirect3DRMTexture3_AddRef(texture); + if (mesh_builder->texture) + IDirect3DRMTexture3_Release(mesh_builder->texture); + mesh_builder->texture = texture; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetMaterial(IDirect3DRMMeshBuilder3 *iface, + IDirect3DRMMaterial2 *material) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, material %p.\n", iface, material); + + if (material) + IDirect3DRMTexture2_AddRef(material); + if (mesh_builder->material) + IDirect3DRMTexture2_Release(mesh_builder->material); + mesh_builder->material = material; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetTextureTopology(IDirect3DRMMeshBuilder3 *iface, + BOOL wrap_u, BOOL wrap_v) +{ + FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetQuality(IDirect3DRMMeshBuilder3 *iface, + D3DRMRENDERQUALITY quality) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, quality %#lx\n", iface, quality); + + mesh_builder->quality = quality; + + return S_OK; +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetPerspective(IDirect3DRMMeshBuilder3 *iface, + BOOL enable) +{ + FIXME("iface %p, enable %#x stub!\n", iface, enable); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetVertex(IDirect3DRMMeshBuilder3 *iface, + DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + FIXME("iface %p, index %lu, x %.8e, y %.8e, z %.8e stub!\n", iface, index, x, y, z); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetNormal(IDirect3DRMMeshBuilder3 *iface, + DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + FIXME("iface %p, index %lu, x %.8e, y %.8e, z %.8e stub!\n", iface, index, x, y, z); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetTextureCoordinates(IDirect3DRMMeshBuilder3 *iface, + DWORD index, D3DVALUE u, D3DVALUE v) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, index %lu, u %.8e, v %.8e.\n", iface, index, u, v); + + if (index >= mesh_builder->nb_coords2d) + return D3DRMERR_BADVALUE; + + mesh_builder->pCoords2d[index].u = u; + mesh_builder->pCoords2d[index].v = v; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetVertexColor(IDirect3DRMMeshBuilder3 *iface, + DWORD index, D3DCOLOR color) +{ + FIXME("iface %p, index %lu, color 0x%08lx stub!\n", iface, index, color); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetVertexColorRGB(IDirect3DRMMeshBuilder3 *iface, + DWORD index, D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + FIXME("iface %p, index %lu, red %.8e, green %.8e, blue %.8e stub!\n", + iface, index, red, green, blue); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_GetFaces(IDirect3DRMMeshBuilder3 *iface, + IDirect3DRMFaceArray **array) +{ + FIXME("iface %p, array %p stub!\n", iface, array); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_GetGeometry(IDirect3DRMMeshBuilder3 *iface, + DWORD *vertex_count, D3DVECTOR *vertices, DWORD *normal_count, D3DVECTOR *normals, + DWORD *face_data_size, DWORD *face_data) +{ + FIXME("iface %p, vertex_count %p, vertices %p, normal_count %p, normals %p, " + "face_data_size %p, face_data %p stub!\n", + iface, vertex_count, vertices, normal_count, normals, face_data_size, face_data); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_GetTextureCoordinates(IDirect3DRMMeshBuilder3 *iface, + DWORD index, D3DVALUE *u, D3DVALUE *v) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, index %lu, u %p, v %p.\n", iface, index, u, v); + + if (index >= mesh_builder->nb_coords2d) + return D3DRMERR_BADVALUE; + + *u = mesh_builder->pCoords2d[index].u; + *v = mesh_builder->pCoords2d[index].v; + + return D3DRM_OK; +} + +static int WINAPI d3drm_mesh_builder3_AddVertex(IDirect3DRMMeshBuilder3 *iface, + D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, x %.8e, y %.8e, z %.8e.\n", iface, x, y, z); + + if (!d3drm_array_reserve((void **)&mesh_builder->vertices, &mesh_builder->vertices_size, + mesh_builder->nb_vertices + 1, sizeof(*mesh_builder->vertices))) + return 0; + + mesh_builder->vertices[mesh_builder->nb_vertices].x = x; + mesh_builder->vertices[mesh_builder->nb_vertices].y = y; + mesh_builder->vertices[mesh_builder->nb_vertices].z = z; + + return mesh_builder->nb_vertices++; +} + +static int WINAPI d3drm_mesh_builder3_AddNormal(IDirect3DRMMeshBuilder3 *iface, + D3DVALUE x, D3DVALUE y, D3DVALUE z) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p, x %.8e, y %.8e, z %.8e.\n", iface, x, y, z); + + if (!d3drm_array_reserve((void **)&mesh_builder->normals, &mesh_builder->normals_size, + mesh_builder->nb_normals + 1, sizeof(*mesh_builder->normals))) + return 0; + + mesh_builder->normals[mesh_builder->nb_normals].x = x; + mesh_builder->normals[mesh_builder->nb_normals].y = y; + mesh_builder->normals[mesh_builder->nb_normals].z = z; + + return mesh_builder->nb_normals++; +} + +static HRESULT WINAPI d3drm_mesh_builder3_CreateFace(IDirect3DRMMeshBuilder3 *iface, IDirect3DRMFace2 **face) +{ + struct d3drm_face *object; + HRESULT hr; + + TRACE("iface %p, face %p.\n", iface, face); + + if (FAILED(hr = d3drm_face_create(&object))) + return hr; + + *face = &object->IDirect3DRMFace2_iface; + + return S_OK; +} + +static D3DRMRENDERQUALITY WINAPI d3drm_mesh_builder3_GetQuality(IDirect3DRMMeshBuilder3 *iface) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p\n", iface); + + return mesh_builder->quality; +} + +static BOOL WINAPI d3drm_mesh_builder3_GetPerspective(IDirect3DRMMeshBuilder3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return FALSE; +} + +static int WINAPI d3drm_mesh_builder3_GetFaceCount(IDirect3DRMMeshBuilder3 *iface) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p.\n", iface); + + return mesh_builder->nb_faces; +} + +static int WINAPI d3drm_mesh_builder3_GetVertexCount(IDirect3DRMMeshBuilder3 *iface) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p.\n", iface); + + return mesh_builder->nb_vertices; +} + +static D3DCOLOR WINAPI d3drm_mesh_builder3_GetVertexColor(IDirect3DRMMeshBuilder3 *iface, + DWORD index) +{ + FIXME("iface %p, index %lu stub!\n", iface, index); + + return 0; +} + +static HRESULT WINAPI d3drm_mesh_builder3_CreateMesh(IDirect3DRMMeshBuilder3 *iface, IDirect3DRMMesh **mesh) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + HRESULT hr; + D3DRMGROUPINDEX group; + + TRACE("iface %p, mesh %p.\n", iface, mesh); + + if (!mesh) + return E_POINTER; + + hr = IDirect3DRM_CreateMesh(mesh_builder->d3drm, mesh); + if (FAILED(hr)) + return hr; + + /* If there is mesh data, create a group and put data inside */ + if (mesh_builder->nb_vertices) + { + DWORD i, j; + int k; + D3DRMVERTEX* vertices; + + if (!(vertices = calloc(mesh_builder->nb_vertices, sizeof(*vertices)))) + { + IDirect3DRMMesh_Release(*mesh); + return E_OUTOFMEMORY; + } + for (i = 0; i < mesh_builder->nb_vertices; i++) + vertices[i].position = mesh_builder->vertices[i]; + hr = IDirect3DRMMesh_SetVertices(*mesh, 0, 0, mesh_builder->nb_vertices, vertices); + free(vertices); + + /* Groups are in reverse order compared to materials list in X file */ + for (k = mesh_builder->nb_materials - 1; k >= 0; k--) + { + unsigned* face_data; + unsigned* out_ptr; + DWORD* in_ptr = mesh_builder->pFaceData; + ULONG vertex_per_face = 0; + BOOL* used_vertices; + unsigned nb_vertices = 0; + unsigned nb_faces = 0; + + if (!(used_vertices = calloc(mesh_builder->face_data_size, sizeof(*used_vertices)))) + { + IDirect3DRMMesh_Release(*mesh); + return E_OUTOFMEMORY; + } + + if (!(face_data = calloc(mesh_builder->face_data_size, sizeof(*face_data)))) + { + free(used_vertices); + IDirect3DRMMesh_Release(*mesh); + return E_OUTOFMEMORY; + } + out_ptr = face_data; + + /* If all faces have the same number of vertex, set vertex_per_face */ + for (i = 0; i < mesh_builder->nb_faces; i++) + { + /* Process only faces belonging to the group */ + if (mesh_builder->material_indices[i] == k) + { + if (vertex_per_face && (vertex_per_face != *in_ptr)) + break; + vertex_per_face = *in_ptr; + } + in_ptr += 1 + *in_ptr * 2; + } + if (i != mesh_builder->nb_faces) + vertex_per_face = 0; + + /* Put only vertex indices */ + in_ptr = mesh_builder->pFaceData; + for (i = 0; i < mesh_builder->nb_faces; i++) + { + DWORD nb_indices = *in_ptr++; + + /* Skip faces not belonging to the group */ + if (mesh_builder->material_indices[i] != k) + { + in_ptr += 2 * nb_indices; + continue; + } + + /* Don't put nb indices when vertex_per_face is set */ + if (vertex_per_face) + *out_ptr++ = nb_indices; + + for (j = 0; j < nb_indices; j++) + { + *out_ptr = *in_ptr++; + used_vertices[*out_ptr++] = TRUE; + /* Skip normal index */ + in_ptr++; + } + + nb_faces++; + } + + for (i = 0; i < mesh_builder->nb_vertices; i++) + if (used_vertices[i]) + nb_vertices++; + + hr = IDirect3DRMMesh_AddGroup(*mesh, nb_vertices, nb_faces, vertex_per_face, face_data, &group); + free(used_vertices); + free(face_data); + if (SUCCEEDED(hr)) + hr = IDirect3DRMMesh_SetGroupColor(*mesh, group, mesh_builder->materials[k].color); + if (SUCCEEDED(hr)) + hr = IDirect3DRMMesh_SetGroupMaterial(*mesh, group, + (IDirect3DRMMaterial *)mesh_builder->materials[k].material); + if (SUCCEEDED(hr) && mesh_builder->materials[k].texture) + { + IDirect3DRMTexture *texture; + + IDirect3DRMTexture3_QueryInterface(mesh_builder->materials[k].texture, + &IID_IDirect3DRMTexture, (void **)&texture); + hr = IDirect3DRMMesh_SetGroupTexture(*mesh, group, texture); + IDirect3DRMTexture_Release(texture); + } + if (FAILED(hr)) + { + IDirect3DRMMesh_Release(*mesh); + return hr; + } + } + } + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_builder3_GetFace(IDirect3DRMMeshBuilder3 *iface, + DWORD index, IDirect3DRMFace2 **face) +{ + FIXME("iface %p, index %lu, face %p stub!\n", iface, index, face); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_GetVertex(IDirect3DRMMeshBuilder3 *iface, + DWORD index, D3DVECTOR *vector) +{ + FIXME("iface %p, index %lu, vector %p stub!\n", iface, index, vector); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_GetNormal(IDirect3DRMMeshBuilder3 *iface, + DWORD index, D3DVECTOR *vector) +{ + FIXME("iface %p, index %lu, vector %p stub!\n", iface, index, vector); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_DeleteVertices(IDirect3DRMMeshBuilder3 *iface, + DWORD start_idx, DWORD count) +{ + FIXME("iface %p, start_idx %lu, count %lu stub!\n", iface, start_idx, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_DeleteNormals(IDirect3DRMMeshBuilder3 *iface, + DWORD start_idx, DWORD count) +{ + FIXME("iface %p, start_idx %lu, count %lu stub!\n", iface, start_idx, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_DeleteFace(IDirect3DRMMeshBuilder3 *iface, IDirect3DRMFace2 *face) +{ + FIXME("iface %p, face %p stub!\n", iface, face); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_Empty(IDirect3DRMMeshBuilder3 *iface, DWORD flags) +{ + FIXME("iface %p, flags %#lx stub!\n", iface, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_Optimize(IDirect3DRMMeshBuilder3 *iface, DWORD flags) +{ + FIXME("iface %p, flags %#lx stub!\n", iface, flags); + + return S_OK; +} + +static HRESULT WINAPI d3drm_mesh_builder3_AddFacesIndexed(IDirect3DRMMeshBuilder3 *iface, + DWORD flags, DWORD *indices, DWORD *start_idx, DWORD *count) +{ + FIXME("iface %p, flags %#lx, indices %p, start_idx %p, count %p stub!\n", + iface, flags, indices, start_idx, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_CreateSubMesh(IDirect3DRMMeshBuilder3 *iface, IUnknown **mesh) +{ + FIXME("iface %p, mesh %p stub!\n", iface, mesh); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_GetParentMesh(IDirect3DRMMeshBuilder3 *iface, + DWORD flags, IUnknown **parent) +{ + FIXME("iface %p, flags %#lx, parent %p stub!\n", iface, flags, parent); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_GetSubMeshes(IDirect3DRMMeshBuilder3 *iface, + DWORD *count, IUnknown **meshes) +{ + FIXME("iface %p, count %p, meshes %p stub!\n", iface, count, meshes); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_DeleteSubMesh(IDirect3DRMMeshBuilder3 *iface, IUnknown *mesh) +{ + FIXME("iface %p, mesh %p stub!\n", iface, mesh); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_Enable(IDirect3DRMMeshBuilder3 *iface, DWORD index) +{ + FIXME("iface %p, index %lu stub!\n", iface, index); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_GetEnable(IDirect3DRMMeshBuilder3 *iface, DWORD *indices) +{ + FIXME("iface %p, indices %p stub!\n", iface, indices); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_AddTriangles(IDirect3DRMMeshBuilder3 *iface, + DWORD flags, DWORD format, DWORD vertex_count, void *data) +{ + FIXME("iface %p, flags %#lx, format %#lx, vertex_count %lu, data %p stub!\n", + iface, flags, format, vertex_count, data); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetVertices(IDirect3DRMMeshBuilder3 *iface, + DWORD start_idx, DWORD count, D3DVECTOR *vector) +{ + FIXME("iface %p, start_idx %lu, count %lu, vector %p stub!\n", iface, start_idx, count, vector); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_GetVertices(IDirect3DRMMeshBuilder3 *iface, + DWORD start_idx, DWORD *vertex_count, D3DVECTOR *vertices) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + DWORD count = mesh_builder->nb_vertices - start_idx; + + TRACE("iface %p, start_idx %lu, vertex_count %p, vertices %p.\n", + iface, start_idx, vertex_count, vertices); + + if (vertex_count) + *vertex_count = count; + if (vertices && mesh_builder->nb_vertices) + memcpy(vertices, mesh_builder->vertices + start_idx, count * sizeof(*vertices)); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_builder3_SetNormals(IDirect3DRMMeshBuilder3 *iface, + DWORD start_idx, DWORD count, D3DVECTOR *vector) +{ + FIXME("iface %p, start_idx %lu, count %lu, vector %p stub!\n", + iface, start_idx, count, vector); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_builder3_GetNormals(IDirect3DRMMeshBuilder3 *iface, + DWORD start_idx, DWORD *normal_count, D3DVECTOR *normals) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + DWORD count = mesh_builder->nb_normals - start_idx; + + TRACE("iface %p, start_idx %lu, normal_count %p, normals %p.\n", + iface, start_idx, normal_count, normals); + + if (normal_count) + *normal_count = count; + if (normals && mesh_builder->nb_normals) + memcpy(normals, &mesh_builder->normals[start_idx], count * sizeof(*normals)); + + return D3DRM_OK; +} + +static int WINAPI d3drm_mesh_builder3_GetNormalCount(IDirect3DRMMeshBuilder3 *iface) +{ + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface); + + TRACE("iface %p.\n", iface); + + return mesh_builder->nb_normals; +} + +static const struct IDirect3DRMMeshBuilder3Vtbl d3drm_mesh_builder3_vtbl = +{ + d3drm_mesh_builder3_QueryInterface, + d3drm_mesh_builder3_AddRef, + d3drm_mesh_builder3_Release, + d3drm_mesh_builder3_Clone, + d3drm_mesh_builder3_AddDestroyCallback, + d3drm_mesh_builder3_DeleteDestroyCallback, + d3drm_mesh_builder3_SetAppData, + d3drm_mesh_builder3_GetAppData, + d3drm_mesh_builder3_SetName, + d3drm_mesh_builder3_GetName, + d3drm_mesh_builder3_GetClassName, + d3drm_mesh_builder3_Load, + d3drm_mesh_builder3_Save, + d3drm_mesh_builder3_Scale, + d3drm_mesh_builder3_Translate, + d3drm_mesh_builder3_SetColorSource, + d3drm_mesh_builder3_GetBox, + d3drm_mesh_builder3_GenerateNormals, + d3drm_mesh_builder3_GetColorSource, + d3drm_mesh_builder3_AddMesh, + d3drm_mesh_builder3_AddMeshBuilder, + d3drm_mesh_builder3_AddFrame, + d3drm_mesh_builder3_AddFace, + d3drm_mesh_builder3_AddFaces, + d3drm_mesh_builder3_ReserveSpace, + d3drm_mesh_builder3_SetColorRGB, + d3drm_mesh_builder3_SetColor, + d3drm_mesh_builder3_SetTexture, + d3drm_mesh_builder3_SetMaterial, + d3drm_mesh_builder3_SetTextureTopology, + d3drm_mesh_builder3_SetQuality, + d3drm_mesh_builder3_SetPerspective, + d3drm_mesh_builder3_SetVertex, + d3drm_mesh_builder3_SetNormal, + d3drm_mesh_builder3_SetTextureCoordinates, + d3drm_mesh_builder3_SetVertexColor, + d3drm_mesh_builder3_SetVertexColorRGB, + d3drm_mesh_builder3_GetFaces, + d3drm_mesh_builder3_GetGeometry, + d3drm_mesh_builder3_GetTextureCoordinates, + d3drm_mesh_builder3_AddVertex, + d3drm_mesh_builder3_AddNormal, + d3drm_mesh_builder3_CreateFace, + d3drm_mesh_builder3_GetQuality, + d3drm_mesh_builder3_GetPerspective, + d3drm_mesh_builder3_GetFaceCount, + d3drm_mesh_builder3_GetVertexCount, + d3drm_mesh_builder3_GetVertexColor, + d3drm_mesh_builder3_CreateMesh, + d3drm_mesh_builder3_GetFace, + d3drm_mesh_builder3_GetVertex, + d3drm_mesh_builder3_GetNormal, + d3drm_mesh_builder3_DeleteVertices, + d3drm_mesh_builder3_DeleteNormals, + d3drm_mesh_builder3_DeleteFace, + d3drm_mesh_builder3_Empty, + d3drm_mesh_builder3_Optimize, + d3drm_mesh_builder3_AddFacesIndexed, + d3drm_mesh_builder3_CreateSubMesh, + d3drm_mesh_builder3_GetParentMesh, + d3drm_mesh_builder3_GetSubMeshes, + d3drm_mesh_builder3_DeleteSubMesh, + d3drm_mesh_builder3_Enable, + d3drm_mesh_builder3_GetEnable, + d3drm_mesh_builder3_AddTriangles, + d3drm_mesh_builder3_SetVertices, + d3drm_mesh_builder3_GetVertices, + d3drm_mesh_builder3_SetNormals, + d3drm_mesh_builder3_GetNormals, + d3drm_mesh_builder3_GetNormalCount, +}; + +HRESULT d3drm_mesh_builder_create(struct d3drm_mesh_builder **mesh_builder, IDirect3DRM *d3drm) +{ + static const char classname[] = "Builder"; + struct d3drm_mesh_builder *object; + + TRACE("mesh_builder %p.\n", mesh_builder); + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IDirect3DRMMeshBuilder2_iface.lpVtbl = &d3drm_mesh_builder2_vtbl; + object->IDirect3DRMMeshBuilder3_iface.lpVtbl = &d3drm_mesh_builder3_vtbl; + object->ref = 1; + object->d3drm = d3drm; + object->quality = D3DRMRENDER_GOURAUD; + IDirect3DRM_AddRef(object->d3drm); + + d3drm_object_init(&object->obj, classname); + + *mesh_builder = object; + + return S_OK; +} + +static HRESULT WINAPI d3drm_mesh_QueryInterface(IDirect3DRMMesh *iface, REFIID riid, void **out) +{ + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRMMesh) + || IsEqualGUID(riid, &IID_IDirect3DRMVisual) + || IsEqualGUID(riid, &IID_IDirect3DRMObject) + || IsEqualGUID(riid, &IID_IUnknown)) + { + IDirect3DRMMesh_AddRef(iface); + *out = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI d3drm_mesh_AddRef(IDirect3DRMMesh *iface) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + ULONG refcount = InterlockedIncrement(&mesh->ref); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI d3drm_mesh_Release(IDirect3DRMMesh *iface) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + ULONG refcount = InterlockedDecrement(&mesh->ref); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + { + DWORD i; + + d3drm_object_cleanup((IDirect3DRMObject *)iface, &mesh->obj); + IDirect3DRM_Release(mesh->d3drm); + for (i = 0; i < mesh->nb_groups; ++i) + { + free(mesh->groups[i].vertices); + free(mesh->groups[i].face_data); + if (mesh->groups[i].material) + IDirect3DRMMaterial2_Release(mesh->groups[i].material); + if (mesh->groups[i].texture) + IDirect3DRMTexture3_Release(mesh->groups[i].texture); + } + free(mesh->groups); + free(mesh); + } + + return refcount; +} + +static HRESULT WINAPI d3drm_mesh_Clone(IDirect3DRMMesh *iface, + IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_AddDestroyCallback(IDirect3DRMMesh *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_add_destroy_callback(&mesh->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_mesh_DeleteDestroyCallback(IDirect3DRMMesh *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_delete_destroy_callback(&mesh->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_mesh_SetAppData(IDirect3DRMMesh *iface, DWORD data) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + mesh->obj.appdata = data; + + return D3DRM_OK; +} + +static DWORD WINAPI d3drm_mesh_GetAppData(IDirect3DRMMesh *iface) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p.\n", iface); + + return mesh->obj.appdata; +} + +static HRESULT WINAPI d3drm_mesh_SetName(IDirect3DRMMesh *iface, const char *name) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_object_set_name(&mesh->obj, name); +} + +static HRESULT WINAPI d3drm_mesh_GetName(IDirect3DRMMesh *iface, DWORD *size, char *name) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_name(&mesh->obj, size, name); +} + +static HRESULT WINAPI d3drm_mesh_GetClassName(IDirect3DRMMesh *iface, DWORD *size, char *name) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_class_name(&mesh->obj, size, name); +} + +static HRESULT WINAPI d3drm_mesh_Scale(IDirect3DRMMesh *iface, + D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) +{ + FIXME("iface %p, sx %.8e, sy %.8e, sz %.8e stub!\n", iface, sx, sy, sz); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_Translate(IDirect3DRMMesh *iface, + D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) +{ + FIXME("iface %p, tx %.8e, ty %.8e, tz %.8e stub!\n", iface, tx, ty, tz); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_GetBox(IDirect3DRMMesh *iface, D3DRMBOX *box) +{ + FIXME("iface %p, box %p stub!\n", iface, box); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_AddGroup(IDirect3DRMMesh *iface, unsigned vertex_count, + unsigned face_count, unsigned vertex_per_face, unsigned *face_data, D3DRMGROUPINDEX *id) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + struct mesh_group *group; + + TRACE("iface %p, vertex_count %u, face_count %u, vertex_per_face %u, face_data %p, id %p.\n", + iface, vertex_count, face_count, vertex_per_face, face_data, id); + + if (!face_data || !id) + return E_POINTER; + + if (!d3drm_array_reserve((void **)&mesh->groups, &mesh->groups_size, mesh->nb_groups + 1, sizeof(*mesh->groups))) + return E_OUTOFMEMORY; + + group = mesh->groups + mesh->nb_groups; + + if (!(group->vertices = calloc(vertex_count, sizeof(*group->vertices)))) + return E_OUTOFMEMORY; + group->nb_vertices = vertex_count; + group->nb_faces = face_count; + group->vertex_per_face = vertex_per_face; + + if (vertex_per_face) + { + group->face_data_size = face_count * vertex_per_face; + } + else + { + unsigned i; + unsigned nb_indices; + unsigned* face_data_ptr = face_data; + group->face_data_size = 0; + + for (i = 0; i < face_count; i++) + { + nb_indices = *face_data_ptr; + group->face_data_size += nb_indices + 1; + face_data_ptr += nb_indices; + } + } + + if (!(group->face_data = calloc(group->face_data_size, sizeof(*group->face_data)))) + { + free(group->vertices); + return E_OUTOFMEMORY; + } + memcpy(group->face_data, face_data, group->face_data_size * sizeof(*face_data)); + + group->material = NULL; + group->texture = NULL; + + *id = mesh->nb_groups++; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_SetVertices(IDirect3DRMMesh *iface, D3DRMGROUPINDEX group_id, + unsigned int start_idx, unsigned int count, D3DRMVERTEX *values) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, group_id %#lx, start_idx %u, count %u, values %p.\n", + iface, group_id, start_idx, count, values); + + if (group_id >= mesh->nb_groups) + return D3DRMERR_BADVALUE; + + if ((start_idx + count - 1) >= mesh->groups[group_id].nb_vertices) + return D3DRMERR_BADVALUE; + + if (!values) + return E_POINTER; + + memcpy(mesh->groups[group_id].vertices + start_idx, values, count * sizeof(*values)); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_SetGroupColor(IDirect3DRMMesh *iface, D3DRMGROUPINDEX id, D3DCOLOR color) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, id %#lx, color 0x%08lx.\n", iface, id, color); + + if (id >= mesh->nb_groups) + return D3DRMERR_BADVALUE; + + mesh->groups[id].color = color; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_SetGroupColorRGB(IDirect3DRMMesh *iface, + D3DRMGROUPINDEX id, D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, id %#lx, red %.8e, green %.8e, blue %.8e.\n", iface, id, red, green, blue); + + if (id >= mesh->nb_groups) + return D3DRMERR_BADVALUE; + + d3drm_set_color(&mesh->groups[id].color, red, green, blue, 1.0f); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_SetGroupMapping(IDirect3DRMMesh *iface, D3DRMGROUPINDEX id, D3DRMMAPPING value) +{ + FIXME("iface %p, id %#lx, value %#lx stub!\n", iface, id, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_SetGroupQuality(IDirect3DRMMesh *iface, D3DRMGROUPINDEX id, D3DRMRENDERQUALITY value) +{ + FIXME("iface %p, id %#lx, value %#lx stub!\n", iface, id, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_mesh_SetGroupMaterial(IDirect3DRMMesh *iface, + D3DRMGROUPINDEX id, IDirect3DRMMaterial *material) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, id %#lx, material %p.\n", iface, id, material); + + if (id >= mesh->nb_groups) + return D3DRMERR_BADVALUE; + + if (mesh->groups[id].material) + IDirect3DRMMaterial2_Release(mesh->groups[id].material); + + mesh->groups[id].material = (IDirect3DRMMaterial2 *)material; + + if (material) + IDirect3DRMMaterial2_AddRef(mesh->groups[id].material); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_SetGroupTexture(IDirect3DRMMesh *iface, + D3DRMGROUPINDEX id, IDirect3DRMTexture *texture) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, id %#lx, texture %p.\n", iface, id, texture); + + if (id >= mesh->nb_groups) + return D3DRMERR_BADVALUE; + + if (mesh->groups[id].texture) + IDirect3DRMTexture3_Release(mesh->groups[id].texture); + + if (!texture) + { + mesh->groups[id].texture = NULL; + return D3DRM_OK; + } + + return IDirect3DRMTexture3_QueryInterface(texture, &IID_IDirect3DRMTexture, (void **)&mesh->groups[id].texture); +} + +static UINT WINAPI d3drm_mesh_GetGroupCount(IDirect3DRMMesh *iface) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p.\n", iface); + + return mesh->nb_groups; +} + +static HRESULT WINAPI d3drm_mesh_GetGroup(IDirect3DRMMesh *iface, D3DRMGROUPINDEX id, unsigned *vertex_count, + unsigned *face_count, unsigned *vertex_per_face, DWORD *face_data_size, unsigned *face_data) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, id %#lx, vertex_count %p, face_count %p, vertex_per_face %p, face_data_size %p, face_data %p.\n", + iface, id, vertex_count, face_count, vertex_per_face, face_data_size,face_data); + + if (id >= mesh->nb_groups) + return D3DRMERR_BADVALUE; + + if (vertex_count) + *vertex_count = mesh->groups[id].nb_vertices; + if (face_count) + *face_count = mesh->groups[id].nb_faces; + if (vertex_per_face) + *vertex_per_face = mesh->groups[id].vertex_per_face; + if (face_data_size) + *face_data_size = mesh->groups[id].face_data_size; + if (face_data) + memcpy(face_data, mesh->groups[id].face_data, mesh->groups[id].face_data_size * sizeof(*face_data)); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_GetVertices(IDirect3DRMMesh *iface, + D3DRMGROUPINDEX group_id, DWORD start_idx, DWORD count, D3DRMVERTEX *vertices) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, group_id %#lx, start_idx %lu, count %lu, vertices %p.\n", + iface, group_id, start_idx, count, vertices); + + if (group_id >= mesh->nb_groups) + return D3DRMERR_BADVALUE; + + if ((start_idx + count - 1) >= mesh->groups[group_id].nb_vertices) + return D3DRMERR_BADVALUE; + + if (!vertices) + return E_POINTER; + + memcpy(vertices, mesh->groups[group_id].vertices + start_idx, count * sizeof(*vertices)); + + return D3DRM_OK; +} + +static D3DCOLOR WINAPI d3drm_mesh_GetGroupColor(IDirect3DRMMesh *iface, D3DRMGROUPINDEX id) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, id %#lx.\n", iface, id); + + return mesh->groups[id].color; +} + +static D3DRMMAPPING WINAPI d3drm_mesh_GetGroupMapping(IDirect3DRMMesh *iface, D3DRMGROUPINDEX id) +{ + FIXME("iface %p, id %#lx stub!\n", iface, id); + + return 0; +} +static D3DRMRENDERQUALITY WINAPI d3drm_mesh_GetGroupQuality(IDirect3DRMMesh *iface, D3DRMGROUPINDEX id) +{ + FIXME("iface %p, id %#lx stub!\n", iface, id); + + return 0; +} + +static HRESULT WINAPI d3drm_mesh_GetGroupMaterial(IDirect3DRMMesh *iface, + D3DRMGROUPINDEX id, IDirect3DRMMaterial **material) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, id %#lx, material %p.\n", iface, id, material); + + if (id >= mesh->nb_groups) + return D3DRMERR_BADVALUE; + + if (!material) + return E_POINTER; + + if (mesh->groups[id].material) + IDirect3DRMTexture_QueryInterface(mesh->groups[id].material, &IID_IDirect3DRMMaterial, (void **)material); + else + *material = NULL; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_mesh_GetGroupTexture(IDirect3DRMMesh *iface, + D3DRMGROUPINDEX id, IDirect3DRMTexture **texture) +{ + struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface); + + TRACE("iface %p, id %#lx, texture %p.\n", iface, id, texture); + + if (id >= mesh->nb_groups) + return D3DRMERR_BADVALUE; + + if (!texture) + return E_POINTER; + + if (mesh->groups[id].texture) + IDirect3DRMTexture_QueryInterface(mesh->groups[id].texture, &IID_IDirect3DRMTexture, (void **)texture); + else + *texture = NULL; + + return D3DRM_OK; +} + +static const struct IDirect3DRMMeshVtbl d3drm_mesh_vtbl = +{ + d3drm_mesh_QueryInterface, + d3drm_mesh_AddRef, + d3drm_mesh_Release, + d3drm_mesh_Clone, + d3drm_mesh_AddDestroyCallback, + d3drm_mesh_DeleteDestroyCallback, + d3drm_mesh_SetAppData, + d3drm_mesh_GetAppData, + d3drm_mesh_SetName, + d3drm_mesh_GetName, + d3drm_mesh_GetClassName, + d3drm_mesh_Scale, + d3drm_mesh_Translate, + d3drm_mesh_GetBox, + d3drm_mesh_AddGroup, + d3drm_mesh_SetVertices, + d3drm_mesh_SetGroupColor, + d3drm_mesh_SetGroupColorRGB, + d3drm_mesh_SetGroupMapping, + d3drm_mesh_SetGroupQuality, + d3drm_mesh_SetGroupMaterial, + d3drm_mesh_SetGroupTexture, + d3drm_mesh_GetGroupCount, + d3drm_mesh_GetGroup, + d3drm_mesh_GetVertices, + d3drm_mesh_GetGroupColor, + d3drm_mesh_GetGroupMapping, + d3drm_mesh_GetGroupQuality, + d3drm_mesh_GetGroupMaterial, + d3drm_mesh_GetGroupTexture, +}; + +HRESULT d3drm_mesh_create(struct d3drm_mesh **mesh, IDirect3DRM *d3drm) +{ + static const char classname[] = "Mesh"; + struct d3drm_mesh *object; + + TRACE("mesh %p, d3drm %p.\n", mesh, d3drm); + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IDirect3DRMMesh_iface.lpVtbl = &d3drm_mesh_vtbl; + object->ref = 1; + object->d3drm = d3drm; + IDirect3DRM_AddRef(object->d3drm); + + d3drm_object_init(&object->obj, classname); + + *mesh = object; + + return S_OK; +} + +static HRESULT WINAPI d3drm_wrap_QueryInterface(IDirect3DRMWrap *iface, REFIID riid, void **out) +{ + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRMWrap) + || IsEqualGUID(riid, &IID_IDirect3DRMObject) + || IsEqualGUID(riid, &IID_IUnknown)) + { + IDirect3DRMWrap_AddRef(iface); + *out = iface; + return S_OK; + } + + WARN("%s not implemented.\n", debugstr_guid(riid)); + + *out = NULL; + return CLASS_E_CLASSNOTAVAILABLE; +} + +static ULONG WINAPI d3drm_wrap_AddRef(IDirect3DRMWrap *iface) +{ + struct d3drm_wrap *wrap = impl_from_IDirect3DRMWrap(iface); + ULONG refcount = InterlockedIncrement(&wrap->ref); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI d3drm_wrap_Release(IDirect3DRMWrap *iface) +{ + struct d3drm_wrap *wrap = impl_from_IDirect3DRMWrap(iface); + ULONG refcount = InterlockedDecrement(&wrap->ref); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + { + d3drm_object_cleanup((IDirect3DRMObject *)iface, &wrap->obj); + free(wrap); + } + + return refcount; +} + +static HRESULT WINAPI d3drm_wrap_Clone(IDirect3DRMWrap *iface, + IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_wrap_AddDestroyCallback(IDirect3DRMWrap *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_wrap *wrap = impl_from_IDirect3DRMWrap(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_add_destroy_callback(&wrap->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_wrap_DeleteDestroyCallback(IDirect3DRMWrap *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_wrap *wrap = impl_from_IDirect3DRMWrap(iface); + + TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx); + + return d3drm_object_delete_destroy_callback(&wrap->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_wrap_SetAppData(IDirect3DRMWrap *iface, DWORD data) +{ + struct d3drm_wrap *wrap = impl_from_IDirect3DRMWrap(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + wrap->obj.appdata = data; + + return D3DRM_OK; +} + +static DWORD WINAPI d3drm_wrap_GetAppData(IDirect3DRMWrap *iface) +{ + struct d3drm_wrap *wrap = impl_from_IDirect3DRMWrap(iface); + + TRACE("iface %p.\n", iface); + + return wrap->obj.appdata; +} + +static HRESULT WINAPI d3drm_wrap_SetName(IDirect3DRMWrap *iface, const char *name) +{ + struct d3drm_wrap *wrap = impl_from_IDirect3DRMWrap(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_object_set_name(&wrap->obj, name); +} + +static HRESULT WINAPI d3drm_wrap_GetName(IDirect3DRMWrap *iface, DWORD *size, char *name) +{ + struct d3drm_wrap *wrap = impl_from_IDirect3DRMWrap(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_name(&wrap->obj, size, name); +} + +static HRESULT WINAPI d3drm_wrap_GetClassName(IDirect3DRMWrap *iface, DWORD *size, char *name) +{ + struct d3drm_wrap *wrap = impl_from_IDirect3DRMWrap(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_class_name(&wrap->obj, size, name); +} + +static HRESULT WINAPI d3drm_wrap_Init(IDirect3DRMWrap *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame *reference, + D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, + D3DVALUE uy, D3DVALUE uz, D3DVALUE ou, D3DVALUE ov, D3DVALUE su, D3DVALUE sv) +{ + FIXME("iface %p, type %d, reference frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, ux %.8e, " + "uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e.\n", iface, type, reference, ox, oy, oz, dx, dy, dz, + ux, uy, uz, ou, ov, su, sv); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_wrap_Apply(IDirect3DRMWrap *iface, IDirect3DRMObject *object) +{ + FIXME("iface %p, object %p.\n", iface, object); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_wrap_ApplyRelative(IDirect3DRMWrap *iface, IDirect3DRMFrame *frame, + IDirect3DRMObject *object) +{ + FIXME("iface %p, frame %p, object %p.\n", iface, frame, object); + + return E_NOTIMPL; +} + +static const struct IDirect3DRMWrapVtbl d3drm_wrap_vtbl = +{ + d3drm_wrap_QueryInterface, + d3drm_wrap_AddRef, + d3drm_wrap_Release, + d3drm_wrap_Clone, + d3drm_wrap_AddDestroyCallback, + d3drm_wrap_DeleteDestroyCallback, + d3drm_wrap_SetAppData, + d3drm_wrap_GetAppData, + d3drm_wrap_SetName, + d3drm_wrap_GetName, + d3drm_wrap_GetClassName, + d3drm_wrap_Init, + d3drm_wrap_Apply, + d3drm_wrap_ApplyRelative, +}; + +HRESULT d3drm_wrap_create(struct d3drm_wrap **wrap, IDirect3DRM *d3drm) +{ + static const char classname[] = ""; + struct d3drm_wrap *object; + + TRACE("wrap %p, d3drm %p.\n", wrap, d3drm); + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IDirect3DRMWrap_iface.lpVtbl = &d3drm_wrap_vtbl; + object->ref = 1; + + d3drm_object_init(&object->obj, classname); + + *wrap = object; + + return S_OK; +} diff --git a/3rdparty/d3drm/rmxfguid.h b/3rdparty/d3drm/rmxfguid.h new file mode 100644 index 00000000..da36e009 --- /dev/null +++ b/3rdparty/d3drm/rmxfguid.h @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2007 Patrik Stridvall + * + * 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 __WINE_RMXFGUID_H +#define __WINE_RMXFGUID_H + +/***************************************************************************** + * Define GUIDs + */ + +DEFINE_GUID(TID_D3DRMAnimation, 0x3d82ab4f, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +DEFINE_GUID(TID_D3DRMAnimationKey, 0x10dd46a8, 0x775b, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMAnimationOptions, 0xe2bf56c0, 0x840f, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMAnimationSet, 0x3d82ab50, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +DEFINE_GUID(TID_D3DRMAppData, 0xe5745280, 0xb24f, 0x11cf, 0x9d, 0xd5, 0x00, 0xaa, 0x00, 0xa7, 0x1a, 0x2f); + +DEFINE_GUID(TID_D3DRMBoolean, 0x537da6a0, 0xca37, 0x11d0, 0x94, 0x1c, 0x00, 0x80, 0xc8, 0x0c, 0xfa, 0x7b); + +DEFINE_GUID(TID_D3DRMBoolean2d, 0x4885ae63, 0x78e8, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMCamera, 0x3d82ab51, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +DEFINE_GUID(TID_D3DRMColorRGB, 0xd3e16e81, 0x7835, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMColorRGBA, 0x35ff44e0, 0x6c7c, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMCoords2d, 0xf6f23f44, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMExternalVisual, 0x98116aa0, 0xbdba, 0x11d1, 0x82, 0xc0, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x71); + +DEFINE_GUID(TID_D3DRMFloatKeys, 0x10dd46a9, 0x775b, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMFrame, 0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +DEFINE_GUID(TID_D3DRMFramePosition, 0xe2bf56c1, 0x840f, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMFrameRotation, 0xe2bf56c3, 0x840f, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMFrameTransformMatrix, 0xf6f23f41, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMFrameVelocity, 0xe2bf56c2, 0x840f, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMGuid, 0xa42790e0, 0x7810, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMIndexedColor, 0x1630b820, 0x7842, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMInfo, 0x2b957100, 0x9e9a, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +DEFINE_GUID(TID_D3DRMInlineData, 0x3a23eea0, 0x94b1, 0x11d0, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +DEFINE_GUID(TID_D3DRMLight, 0x3d82ab4a, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +DEFINE_GUID(TID_D3DRMLightAttenuation, 0xa8a98ba0, 0xc5e5, 0x11cf, 0xb9, 0x41, 0x00, 0x80, 0xc8, 0x0c, 0xfa, 0x7b); + +DEFINE_GUID(TID_D3DRMLightPenumbra, 0xaed22741, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x00, 0xaa, 0x00, 0xa7, 0x1a, 0x2f); + +DEFINE_GUID(TID_D3DRMLightRange, 0xaed22742, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x00, 0xaa, 0x00, 0xa7, 0x1a, 0x2f); + +DEFINE_GUID(TID_D3DRMLightUmbra, 0xaed22740, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x00, 0xaa, 0x00, 0xa7, 0x1a, 0x2f); + +DEFINE_GUID(TID_D3DRMMaterial, 0x3d82ab4d, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +DEFINE_GUID(TID_D3DRMMaterialAmbientColor, 0x01411840, 0x7786, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMMaterialArray, 0x35ff44e1, 0x6c7c, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMMaterialDiffuseColor, 0x01411841, 0x7786, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMMaterialEmissiveColor, 0xd3e16e80, 0x7835, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMMaterialPower, 0x01411843, 0x7786, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMMaterialSpecularColor, 0x01411842, 0x7786, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMMaterialWrap, 0x4885ae60, 0x78e8, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMMatrix4x4, 0xf6f23f45, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMMesh, 0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +DEFINE_GUID(TID_D3DRMMeshFace, 0x3d82ab5f, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +DEFINE_GUID(TID_D3DRMMeshFaceWraps, 0xed1ec5c0, 0xc0a8, 0x11d0, 0x94, 0x1c, 0x00, 0x80, 0xc8, 0x0c, 0xfa, 0x7b); + +DEFINE_GUID(TID_D3DRMMeshMaterialList, 0xf6f23f42, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMMeshNormals, 0xf6f23f43, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMMeshTextureCoords, 0xf6f23f40, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMMeshVertexColors, 0x1630b821, 0x7842, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMProgressiveMesh, 0x8a63c360, 0x997d, 0x11d0, 0x94, 0x1c, 0x00, 0x80, 0xc8, 0x0c, 0xfa, 0x7b); + +DEFINE_GUID(TID_D3DRMPropertyBag, 0x7f0f21e1, 0xbfe1, 0x11d1, 0x82, 0xc0, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x71); + +DEFINE_GUID(TID_D3DRMRightHanded, 0x7f5d5ea0, 0xd53a, 0x11d1, 0x82, 0xc0, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x71); + +DEFINE_GUID(TID_D3DRMStringProperty, 0x7f0f21e0, 0xbfe1, 0x11d1, 0x82, 0xc0, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x71); + +DEFINE_GUID(TID_D3DRMTextureFilename, 0xa42790e1, 0x7810, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMTextureReference, 0xa42790e2, 0x7810, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMTimedFloatKeys, 0xf406b180, 0x7b3b, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3); + +DEFINE_GUID(TID_D3DRMUrl, 0x3a23eea1, 0x94b1, 0x11d0, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +DEFINE_GUID(TID_D3DRMVector, 0x3d82ab5e, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +#endif /* __WINE_RMXFGUID_H */ diff --git a/3rdparty/d3drm/texture.c b/3rdparty/d3drm/texture.c new file mode 100644 index 00000000..09228372 --- /dev/null +++ b/3rdparty/d3drm/texture.c @@ -0,0 +1,1485 @@ +/* + * Implementation of IDirect3DRMTextureX interfaces + * + * Copyright 2012 Christian Costa + * Copyright 2016 Aaryaman Vasishta + * + * 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 + */ + +#include "d3drm_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d3drm); + +static inline struct d3drm_texture *impl_from_IDirect3DRMTexture(IDirect3DRMTexture *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture_iface); +} + +static inline struct d3drm_texture *impl_from_IDirect3DRMTexture2(IDirect3DRMTexture2 *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture2_iface); +} + +static inline struct d3drm_texture *impl_from_IDirect3DRMTexture3(IDirect3DRMTexture3 *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture3_iface); +} + +static void d3drm_texture_destroy(struct d3drm_texture *texture) +{ + TRACE("texture %p is being destroyed.\n", texture); + + d3drm_object_cleanup((IDirect3DRMObject*)&texture->IDirect3DRMTexture_iface, &texture->obj); + if (texture->image || texture->surface) + IDirect3DRM_Release(texture->d3drm); + if (texture->surface) + IDirectDrawSurface_Release(texture->surface); + free(texture); +} + +static BOOL d3drm_validate_image(D3DRMIMAGE *image) +{ + if (!image) + return FALSE; + + TRACE("size (%d, %d), aspect (%d, %d), depth %d, red %#lx, green %#lx, blue %#lx, " + "buffer1 %p, buffer2 %p, rgb %d, pal %p, size %d\n", + image->width, image->height, image->aspectx, image->aspecty, + image->depth, image->red_mask, image->green_mask, image->blue_mask, image->buffer1, + image->buffer2, image->rgb, image->palette, image->palette_size ); + + if (!image->buffer1) + return FALSE; + + if (image->rgb) + { + if (!image->red_mask || !image->green_mask || !image->blue_mask) + return FALSE; + } + else + { + if (!image->palette || !image->palette_size) + return FALSE; + } + + return TRUE; +} + +static BOOL d3drm_image_palettise(D3DRMIMAGE *image, unsigned char *src_data, + SIZE_T w, SIZE_T h, BOOL flip) +{ + unsigned char *dst_data, *src_ptr, *dst_ptr; + SIZE_T src_pitch, dst_pitch, i, x, y; + D3DRMPALETTEENTRY *palette, *entry; + unsigned int colour_count = 0; + + if (w > (~(SIZE_T)0 - 3) / h) + return FALSE; + + src_pitch = flip ? -w * 3 : w * 3; + dst_pitch = (w + 3) & ~3; + + if (!(dst_data = malloc(dst_pitch * h))) + { + WARN("Failed to allocate image buffer.\n"); + return FALSE; + } + memset(dst_data, 0xff, dst_pitch * h); + + if (!(palette = malloc(256 * sizeof(*palette)))) + { + WARN("Failed to allocate palette.\n"); + free(dst_data); + return FALSE; + } + + src_ptr = flip ? &src_data[(h - 1) * w * 3] : src_data; + dst_ptr = dst_data; + + for (y = 0; y < h; ++y) + { + for (x = 0; x < w; ++x) + { + for (i = 0; i < colour_count; ++i) + { + entry = &palette[i]; + if (entry->red == src_ptr[x * 3 + 2] + && entry->green == src_ptr[x * 3 + 1] + && entry->blue == src_ptr[x * 3 + 0]) + break; + } + + if (i == colour_count) + { + if (colour_count == 256) + { + free(dst_data); + free(palette); + return FALSE; + } + + entry = &palette[colour_count++]; + entry->red = src_ptr[x * 3 + 2]; + entry->green = src_ptr[x * 3 + 1]; + entry->blue = src_ptr[x * 3 + 0]; + entry->flags = D3DRMPALETTE_READONLY; + } + + dst_ptr[x] = i; + } + + src_ptr += src_pitch; + dst_ptr += dst_pitch; + } + + image->depth = 8; + image->rgb = 0; + image->bytes_per_line = dst_pitch; + image->buffer1 = dst_data; + image->red_mask = 0xff; + image->green_mask = 0xff; + image->blue_mask = 0xff; + image->palette_size = colour_count; + image->palette = palette; + if ((palette = realloc(palette, colour_count * sizeof(*palette)))) + image->palette = palette; + + return TRUE; +} + +static HRESULT d3drm_image_load_32(D3DRMIMAGE *image, unsigned char *src_data, + LONGLONG src_data_size, SIZE_T w, SIZE_T h, BOOL flip) +{ + unsigned char *dst_data, *src_ptr, *dst_ptr; + SIZE_T src_pitch, dst_pitch, x, y; + + if (d3drm_image_palettise(image, src_data, w, h, flip)) + return D3DRM_OK; + + if (w > (~(SIZE_T)0 / 4) / h) + return D3DRMERR_BADALLOC; + + src_pitch = flip ? -w * 3 : w * 3; + dst_pitch = w * 4; + + if (!(dst_data = malloc(dst_pitch * h))) + { + WARN("Failed to allocate image buffer.\n"); + return D3DRMERR_BADALLOC; + } + + src_ptr = flip ? &src_data[(h - 1) * w * 3] : src_data; + dst_ptr = dst_data; + + for (y = 0; y < h; ++y) + { + for (x = 0; x < w; ++x) + { + dst_ptr[x * 4 + 0] = src_ptr[x * 3 + 0]; + dst_ptr[x * 4 + 1] = src_ptr[x * 3 + 1]; + dst_ptr[x * 4 + 2] = src_ptr[x * 3 + 2]; + dst_ptr[x * 4 + 3] = 0xff; + } + + src_ptr += src_pitch; + dst_ptr += dst_pitch; + } + + image->depth = 32; + image->rgb = 1; + image->bytes_per_line = dst_pitch; + image->buffer1 = dst_data; + image->red_mask = 0xff0000; + image->green_mask = 0x00ff00; + image->blue_mask = 0x0000ff; + image->palette_size = 0; + image->palette = NULL; + + return D3DRM_OK; +} + +static HRESULT d3drm_image_load_8(D3DRMIMAGE *image, const RGBQUAD *palette, + unsigned char *src_data, LONGLONG src_data_size, SIZE_T w, SIZE_T h, BOOL flip) +{ + unsigned char *dst_data; + SIZE_T i; + + if (w > ~(SIZE_T)0 / h) + return D3DRMERR_BADALLOC; + + if (!(dst_data = malloc(w * h))) + { + WARN("Failed to allocate image buffer.\n"); + return D3DRMERR_BADALLOC; + } + + if (!(image->palette = malloc(256 * sizeof(*image->palette)))) + { + WARN("Failed to allocate palette.\n"); + free(dst_data); + return D3DRMERR_BADALLOC; + } + + for (i = 0; i < 256; ++i) + { + image->palette[i].red = palette[i].rgbRed; + image->palette[i].green = palette[i].rgbGreen; + image->palette[i].blue = palette[i].rgbBlue; + image->palette[i].flags = D3DRMPALETTE_READONLY; + } + + if (flip) + { + for (i = 0; i < h; ++i) + { + memcpy(&dst_data[i * w], &src_data[(h - 1 - i) * w], w); + } + } + else + { + memcpy(dst_data, src_data, w * h); + } + + image->depth = 8; + image->rgb = 0; + image->bytes_per_line = w; + image->buffer1 = dst_data; + image->red_mask = 0xff; + image->green_mask = 0xff; + image->blue_mask = 0xff; + image->palette_size = 256; + + return D3DRM_OK; +} + +static void CDECL destroy_image_callback(IDirect3DRMObject *obj, void *arg) +{ + D3DRMIMAGE *image = arg; + + TRACE("texture object %p, image %p.\n", obj, image); + + free(image->buffer1); + free(image); +} + +static HRESULT d3drm_texture_load(struct d3drm_texture *texture, + const char *path, BOOL flip, D3DRMIMAGE **image_out) +{ + BITMAPFILEHEADER *header; + unsigned int w, h, bpp; + HANDLE file, mapping; + LARGE_INTEGER size; + D3DRMIMAGE *image; + BITMAPINFO *info; + LONGLONG rem; + HRESULT hr; + + if ((file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE) + return D3DRMERR_BADOBJECT; + + mapping = CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL); + CloseHandle(file); + if (!mapping || mapping == INVALID_HANDLE_VALUE) + return D3DRMERR_BADVALUE; + + if (!GetFileSizeEx(mapping, &size)) + { + CloseHandle(mapping); + return D3DRMERR_BADVALUE; + } + rem = size.QuadPart; + + header = MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, 0); + CloseHandle(mapping); + if (!header) + return D3DRMERR_BADVALUE; + + hr = D3DRMERR_BADALLOC; + if (!(image = calloc(1, sizeof(*image)))) + goto fail; + + hr = D3DRMERR_BADFILE; + if (rem < sizeof(*header) || header->bfType != 0x4d42 /* BM */) + goto fail; + rem -= sizeof(*header); + + info = (BITMAPINFO *)&header[1]; + /* Only allow version 1 DIB's (BITMAPINFOHEADER) to be loaded. */ + if (rem < sizeof(info->bmiHeader) || info->bmiHeader.biSize != sizeof(info->bmiHeader)) + goto fail; + rem -= sizeof(info->bmiHeader); + + w = info->bmiHeader.biWidth; + h = abs(info->bmiHeader.biHeight); + bpp = info->bmiHeader.biBitCount == 24 ? 32 : info->bmiHeader.biBitCount; + if (bpp != 8 && bpp != 32) + goto fail; + + image->width = w; + image->height = h; + image->aspectx = 1; + image->aspecty = 1; + if (bpp == 8) + { + rem -= 256 * sizeof(*info->bmiColors); + if (w > rem / h) + goto fail; + hr = d3drm_image_load_8(image, info->bmiColors, (unsigned char *)&info->bmiColors[256], rem, w, h, flip); + } + else + { + if (w > (rem / 3) / h) + goto fail; + hr = d3drm_image_load_32(image, (unsigned char *)&info->bmiColors, rem, w, h, flip); + } + if (FAILED(hr)) + goto fail; + + /* Use an internal destroy callback to destroy the image struct. */ + hr = IDirect3DRMObject_AddDestroyCallback(&texture->IDirect3DRMTexture3_iface, destroy_image_callback, image); + + *image_out = image; + + UnmapViewOfFile(header); + + return hr; + +fail: + free(image); + UnmapViewOfFile(header); + + return hr; +} + +static HRESULT WINAPI d3drm_texture1_QueryInterface(IDirect3DRMTexture *iface, REFIID riid, void **out) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + return IDirect3DRMTexture3_QueryInterface(&texture->IDirect3DRMTexture3_iface, riid, out); +} + +static ULONG WINAPI d3drm_texture1_AddRef(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_AddRef(&texture->IDirect3DRMTexture3_iface); +} + +static ULONG WINAPI d3drm_texture1_Release(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_Release(&texture->IDirect3DRMTexture3_iface); +} + +static HRESULT WINAPI d3drm_texture1_Clone(IDirect3DRMTexture *iface, + IUnknown *outer, REFIID iid, void **out) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out); + + return IDirect3DRMTexture3_Clone(&texture->IDirect3DRMTexture3_iface, outer, iid, out); +} + +static HRESULT WINAPI d3drm_texture1_AddDestroyCallback(IDirect3DRMTexture *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx); + + return IDirect3DRMTexture3_AddDestroyCallback(&texture->IDirect3DRMTexture3_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_texture1_DeleteDestroyCallback(IDirect3DRMTexture *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx); + + return IDirect3DRMTexture3_DeleteDestroyCallback(&texture->IDirect3DRMTexture3_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_texture1_SetAppData(IDirect3DRMTexture *iface, DWORD data) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + return IDirect3DRMTexture3_SetAppData(&texture->IDirect3DRMTexture3_iface, data); +} + +static DWORD WINAPI d3drm_texture1_GetAppData(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetAppData(&texture->IDirect3DRMTexture3_iface); +} + +static HRESULT WINAPI d3drm_texture1_SetName(IDirect3DRMTexture *iface, const char *name) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return IDirect3DRMTexture3_SetName(&texture->IDirect3DRMTexture3_iface, name); +} + +static HRESULT WINAPI d3drm_texture1_GetName(IDirect3DRMTexture *iface, DWORD *size, char *name) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return IDirect3DRMTexture3_GetName(&texture->IDirect3DRMTexture3_iface, size, name); +} + +static HRESULT WINAPI d3drm_texture1_GetClassName(IDirect3DRMTexture *iface, DWORD *size, char *name) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return IDirect3DRMTexture3_GetClassName(&texture->IDirect3DRMTexture3_iface, size, name); +} + +static HRESULT WINAPI d3drm_texture1_InitFromFile(IDirect3DRMTexture *iface, const char *filename) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + D3DRMIMAGE *image; + HRESULT hr; + + TRACE("iface %p, filename %s.\n", iface, debugstr_a(filename)); + + if (FAILED(hr = d3drm_texture_load(texture, filename, FALSE, &image))) + return hr; + + return IDirect3DRMTexture3_InitFromImage(&texture->IDirect3DRMTexture3_iface, image); +} + +static HRESULT WINAPI d3drm_texture1_InitFromSurface(IDirect3DRMTexture *iface, + IDirectDrawSurface *surface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, surface %p.\n", iface, surface); + + return IDirect3DRMTexture3_InitFromSurface(&texture->IDirect3DRMTexture3_iface, surface); +} + +static HRESULT WINAPI d3drm_texture1_InitFromResource(IDirect3DRMTexture *iface, HRSRC resource) +{ + FIXME("iface %p, resource %p stub!\n", iface, resource); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture1_Changed(IDirect3DRMTexture *iface, BOOL pixels, BOOL palette) +{ + FIXME("iface %p, pixels %#x, palette %#x stub!\n", iface, pixels, palette); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture1_SetColors(IDirect3DRMTexture *iface, DWORD max_colors) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, max_colors %lu.\n", iface, max_colors); + + return IDirect3DRMTexture3_SetColors(&texture->IDirect3DRMTexture3_iface, max_colors); +} + +static HRESULT WINAPI d3drm_texture1_SetShades(IDirect3DRMTexture *iface, DWORD max_shades) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, max_shades %lu.\n", iface, max_shades); + + return IDirect3DRMTexture3_SetShades(&texture->IDirect3DRMTexture3_iface, max_shades); +} + +static HRESULT WINAPI d3drm_texture1_SetDecalSize(IDirect3DRMTexture *iface, D3DVALUE width, D3DVALUE height) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, width %.8e, height %.8e.\n", iface, width, height); + + return IDirect3DRMTexture3_SetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height); +} + +static HRESULT WINAPI d3drm_texture1_SetDecalOrigin(IDirect3DRMTexture *iface, LONG x, LONG y) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, x %ld, y %ld.\n", iface, x, y); + + return IDirect3DRMTexture3_SetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y); +} + +static HRESULT WINAPI d3drm_texture1_SetDecalScale(IDirect3DRMTexture *iface, DWORD scale) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, scale %lu.\n", iface, scale); + + return IDirect3DRMTexture3_SetDecalScale(&texture->IDirect3DRMTexture3_iface, scale); +} + +static HRESULT WINAPI d3drm_texture1_SetDecalTransparency(IDirect3DRMTexture *iface, BOOL transparency) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, transparency %#x.\n", iface, transparency); + + return IDirect3DRMTexture3_SetDecalTransparency(&texture->IDirect3DRMTexture3_iface, transparency); +} + +static HRESULT WINAPI d3drm_texture1_SetDecalTransparentColor(IDirect3DRMTexture *iface, D3DCOLOR color) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, color 0x%08lx.\n", iface, color); + + return IDirect3DRMTexture3_SetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface, color); +} + +static HRESULT WINAPI d3drm_texture1_GetDecalSize(IDirect3DRMTexture *iface, D3DVALUE *width, D3DVALUE *height) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, width %p, height %p.\n", iface, width, height); + + return IDirect3DRMTexture3_GetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height); +} + +static HRESULT WINAPI d3drm_texture1_GetDecalOrigin(IDirect3DRMTexture *iface, LONG *x, LONG *y) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, x %p, y %p.\n", iface, x, y); + + return IDirect3DRMTexture3_GetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y); +} + +static D3DRMIMAGE * WINAPI d3drm_texture1_GetImage(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetImage(&texture->IDirect3DRMTexture3_iface); +} + +static DWORD WINAPI d3drm_texture1_GetShades(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetShades(&texture->IDirect3DRMTexture3_iface); +} + +static DWORD WINAPI d3drm_texture1_GetColors(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetColors(&texture->IDirect3DRMTexture3_iface); +} + +static DWORD WINAPI d3drm_texture1_GetDecalScale(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetDecalScale(&texture->IDirect3DRMTexture3_iface); +} + +static BOOL WINAPI d3drm_texture1_GetDecalTransparency(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetDecalTransparency(&texture->IDirect3DRMTexture3_iface); +} + +static D3DCOLOR WINAPI d3drm_texture1_GetDecalTransparentColor(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface); +} + +static const struct IDirect3DRMTextureVtbl d3drm_texture1_vtbl = +{ + d3drm_texture1_QueryInterface, + d3drm_texture1_AddRef, + d3drm_texture1_Release, + d3drm_texture1_Clone, + d3drm_texture1_AddDestroyCallback, + d3drm_texture1_DeleteDestroyCallback, + d3drm_texture1_SetAppData, + d3drm_texture1_GetAppData, + d3drm_texture1_SetName, + d3drm_texture1_GetName, + d3drm_texture1_GetClassName, + d3drm_texture1_InitFromFile, + d3drm_texture1_InitFromSurface, + d3drm_texture1_InitFromResource, + d3drm_texture1_Changed, + d3drm_texture1_SetColors, + d3drm_texture1_SetShades, + d3drm_texture1_SetDecalSize, + d3drm_texture1_SetDecalOrigin, + d3drm_texture1_SetDecalScale, + d3drm_texture1_SetDecalTransparency, + d3drm_texture1_SetDecalTransparentColor, + d3drm_texture1_GetDecalSize, + d3drm_texture1_GetDecalOrigin, + d3drm_texture1_GetImage, + d3drm_texture1_GetShades, + d3drm_texture1_GetColors, + d3drm_texture1_GetDecalScale, + d3drm_texture1_GetDecalTransparency, + d3drm_texture1_GetDecalTransparentColor, +}; + +static HRESULT WINAPI d3drm_texture2_QueryInterface(IDirect3DRMTexture2 *iface, REFIID riid, void **out) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + return IDirect3DRMTexture3_QueryInterface(&texture->IDirect3DRMTexture3_iface, riid, out); +} + +static ULONG WINAPI d3drm_texture2_AddRef(IDirect3DRMTexture2 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_AddRef(&texture->IDirect3DRMTexture3_iface); +} + +static ULONG WINAPI d3drm_texture2_Release(IDirect3DRMTexture2 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_Release(&texture->IDirect3DRMTexture3_iface); +} + +static HRESULT WINAPI d3drm_texture2_Clone(IDirect3DRMTexture2 *iface, + IUnknown *outer, REFIID iid, void **out) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out); + + return IDirect3DRMTexture3_Clone(&texture->IDirect3DRMTexture3_iface, outer, iid, out); +} + +static HRESULT WINAPI d3drm_texture2_AddDestroyCallback(IDirect3DRMTexture2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx); + + return IDirect3DRMTexture3_AddDestroyCallback(&texture->IDirect3DRMTexture3_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_texture2_DeleteDestroyCallback(IDirect3DRMTexture2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx); + + return IDirect3DRMTexture3_DeleteDestroyCallback(&texture->IDirect3DRMTexture3_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_texture2_SetAppData(IDirect3DRMTexture2 *iface, DWORD data) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + return IDirect3DRMTexture3_SetAppData(&texture->IDirect3DRMTexture3_iface, data); +} + +static DWORD WINAPI d3drm_texture2_GetAppData(IDirect3DRMTexture2 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetAppData(&texture->IDirect3DRMTexture3_iface); +} + +static HRESULT WINAPI d3drm_texture2_SetName(IDirect3DRMTexture2 *iface, const char *name) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return IDirect3DRMTexture3_SetName(&texture->IDirect3DRMTexture3_iface, name); +} + +static HRESULT WINAPI d3drm_texture2_GetName(IDirect3DRMTexture2 *iface, DWORD *size, char *name) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return IDirect3DRMTexture3_GetName(&texture->IDirect3DRMTexture3_iface, size, name); +} + +static HRESULT WINAPI d3drm_texture2_GetClassName(IDirect3DRMTexture2 *iface, DWORD *size, char *name) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return IDirect3DRMTexture3_GetClassName(&texture->IDirect3DRMTexture3_iface, size, name); +} + +static HRESULT WINAPI d3drm_texture2_InitFromFile(IDirect3DRMTexture2 *iface, const char *filename) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, filename %s.\n", iface, debugstr_a(filename)); + + return IDirect3DRMTexture3_InitFromFile(&texture->IDirect3DRMTexture3_iface, filename); +} + +static HRESULT WINAPI d3drm_texture2_InitFromSurface(IDirect3DRMTexture2 *iface, + IDirectDrawSurface *surface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, surface %p.\n", iface, surface); + + return IDirect3DRMTexture3_InitFromSurface(&texture->IDirect3DRMTexture3_iface, surface); +} + +static HRESULT WINAPI d3drm_texture2_InitFromResource(IDirect3DRMTexture2 *iface, HRSRC resource) +{ + FIXME("iface %p, resource %p stub!\n", iface, resource); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture2_Changed(IDirect3DRMTexture2 *iface, BOOL pixels, BOOL palette) +{ + FIXME("iface %p, pixels %#x, palette %#x stub!\n", iface, pixels, palette); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture2_SetColors(IDirect3DRMTexture2 *iface, DWORD max_colors) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, max_colors %lu.\n", iface, max_colors); + + return IDirect3DRMTexture3_SetColors(&texture->IDirect3DRMTexture3_iface, max_colors); +} + +static HRESULT WINAPI d3drm_texture2_SetShades(IDirect3DRMTexture2 *iface, DWORD max_shades) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, max_shades %lu.\n", iface, max_shades); + + return IDirect3DRMTexture3_SetShades(&texture->IDirect3DRMTexture3_iface, max_shades); +} + +static HRESULT WINAPI d3drm_texture2_SetDecalSize(IDirect3DRMTexture2 *iface, D3DVALUE width, D3DVALUE height) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, width %.8e, height %.8e.\n", iface, width, height); + + return IDirect3DRMTexture3_SetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height); +} + +static HRESULT WINAPI d3drm_texture2_SetDecalOrigin(IDirect3DRMTexture2 *iface, LONG x, LONG y) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, x %ld, y %ld.\n", iface, x, y); + + return IDirect3DRMTexture3_SetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y); +} + +static HRESULT WINAPI d3drm_texture2_SetDecalScale(IDirect3DRMTexture2 *iface, DWORD scale) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, scale %lu.\n", iface, scale); + + return IDirect3DRMTexture3_SetDecalScale(&texture->IDirect3DRMTexture3_iface, scale); +} + +static HRESULT WINAPI d3drm_texture2_SetDecalTransparency(IDirect3DRMTexture2 *iface, BOOL transparency) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, transparency %#x.\n", iface, transparency); + + return IDirect3DRMTexture3_SetDecalTransparency(&texture->IDirect3DRMTexture3_iface, transparency); +} + +static HRESULT WINAPI d3drm_texture2_SetDecalTransparentColor(IDirect3DRMTexture2 *iface, D3DCOLOR color) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, color 0x%08lx.\n", iface, color); + + return IDirect3DRMTexture3_SetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface, color); +} + +static HRESULT WINAPI d3drm_texture2_GetDecalSize(IDirect3DRMTexture2 *iface, D3DVALUE *width, D3DVALUE *height) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, width %p, height %p.\n", iface, width, height); + + return IDirect3DRMTexture3_GetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height); +} + +static HRESULT WINAPI d3drm_texture2_GetDecalOrigin(IDirect3DRMTexture2 *iface, LONG *x, LONG *y) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, x %p, y %p.\n", iface, x, y); + + return IDirect3DRMTexture3_GetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y); +} + +static D3DRMIMAGE * WINAPI d3drm_texture2_GetImage(IDirect3DRMTexture2 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetImage(&texture->IDirect3DRMTexture3_iface); +} + +static DWORD WINAPI d3drm_texture2_GetShades(IDirect3DRMTexture2 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetShades(&texture->IDirect3DRMTexture3_iface); +} + +static DWORD WINAPI d3drm_texture2_GetColors(IDirect3DRMTexture2 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetColors(&texture->IDirect3DRMTexture3_iface); +} + +static DWORD WINAPI d3drm_texture2_GetDecalScale(IDirect3DRMTexture2 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetDecalScale(&texture->IDirect3DRMTexture3_iface); +} + +static BOOL WINAPI d3drm_texture2_GetDecalTransparency(IDirect3DRMTexture2 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetDecalTransparency(&texture->IDirect3DRMTexture3_iface); +} + +static D3DCOLOR WINAPI d3drm_texture2_GetDecalTransparentColor(IDirect3DRMTexture2 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface); +} + +static HRESULT WINAPI d3drm_texture2_InitFromImage(IDirect3DRMTexture2 *iface, D3DRMIMAGE *image) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, image %p.\n", iface, image); + + return IDirect3DRMTexture3_InitFromImage(&texture->IDirect3DRMTexture3_iface, image); +} + +static HRESULT WINAPI d3drm_texture2_InitFromResource2(IDirect3DRMTexture2 *iface, + HMODULE module, const char *name, const char *type) +{ + FIXME("iface %p, module %p, name %s, type %s stub!\n", + iface, module, debugstr_a(name), debugstr_a(type)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture2_GenerateMIPMap(IDirect3DRMTexture2 *iface, DWORD flags) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, flags %#lx.\n", iface, flags); + + return IDirect3DRMTexture3_GenerateMIPMap(&texture->IDirect3DRMTexture3_iface, flags); +} + +static const struct IDirect3DRMTexture2Vtbl d3drm_texture2_vtbl = +{ + d3drm_texture2_QueryInterface, + d3drm_texture2_AddRef, + d3drm_texture2_Release, + d3drm_texture2_Clone, + d3drm_texture2_AddDestroyCallback, + d3drm_texture2_DeleteDestroyCallback, + d3drm_texture2_SetAppData, + d3drm_texture2_GetAppData, + d3drm_texture2_SetName, + d3drm_texture2_GetName, + d3drm_texture2_GetClassName, + d3drm_texture2_InitFromFile, + d3drm_texture2_InitFromSurface, + d3drm_texture2_InitFromResource, + d3drm_texture2_Changed, + d3drm_texture2_SetColors, + d3drm_texture2_SetShades, + d3drm_texture2_SetDecalSize, + d3drm_texture2_SetDecalOrigin, + d3drm_texture2_SetDecalScale, + d3drm_texture2_SetDecalTransparency, + d3drm_texture2_SetDecalTransparentColor, + d3drm_texture2_GetDecalSize, + d3drm_texture2_GetDecalOrigin, + d3drm_texture2_GetImage, + d3drm_texture2_GetShades, + d3drm_texture2_GetColors, + d3drm_texture2_GetDecalScale, + d3drm_texture2_GetDecalTransparency, + d3drm_texture2_GetDecalTransparentColor, + d3drm_texture2_InitFromImage, + d3drm_texture2_InitFromResource2, + d3drm_texture2_GenerateMIPMap, +}; + +static HRESULT WINAPI d3drm_texture3_QueryInterface(IDirect3DRMTexture3 *iface, REFIID riid, void **out) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRMTexture) + || IsEqualGUID(riid, &IID_IDirect3DRMVisual) + || IsEqualGUID(riid, &IID_IDirect3DRMObject) + || IsEqualGUID(riid, &IID_IUnknown)) + { + *out = &texture->IDirect3DRMTexture_iface; + } + else if (IsEqualGUID(riid, &IID_IDirect3DRMTexture2)) + { + *out = &texture->IDirect3DRMTexture2_iface; + } + else if (IsEqualGUID(riid, &IID_IDirect3DRMTexture3)) + { + *out = &texture->IDirect3DRMTexture3_iface; + } + else + { + *out = NULL; + WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid)); + return CLASS_E_CLASSNOTAVAILABLE; + } + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} + +static ULONG WINAPI d3drm_texture3_AddRef(IDirect3DRMTexture3 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + ULONG refcount = InterlockedIncrement(&texture->obj.ref); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI d3drm_texture3_Release(IDirect3DRMTexture3 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + ULONG refcount = InterlockedDecrement(&texture->obj.ref); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + d3drm_texture_destroy(texture); + + return refcount; +} + +static HRESULT WINAPI d3drm_texture3_Clone(IDirect3DRMTexture3 *iface, + IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture3_AddDestroyCallback(IDirect3DRMTexture3 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx); + + return d3drm_object_add_destroy_callback(&texture->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_texture3_DeleteDestroyCallback(IDirect3DRMTexture3 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx); + + return d3drm_object_delete_destroy_callback(&texture->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_texture3_SetAppData(IDirect3DRMTexture3 *iface, DWORD data) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p, data %#lx.\n", iface, data); + + texture->obj.appdata = data; + + return D3DRM_OK; +} + +static DWORD WINAPI d3drm_texture3_GetAppData(IDirect3DRMTexture3 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p.\n", iface); + + return texture->obj.appdata; +} + +static HRESULT WINAPI d3drm_texture3_SetName(IDirect3DRMTexture3 *iface, const char *name) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_object_set_name(&texture->obj, name); +} + +static HRESULT WINAPI d3drm_texture3_GetName(IDirect3DRMTexture3 *iface, DWORD *size, char *name) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_name(&texture->obj, size, name); +} + +static HRESULT WINAPI d3drm_texture3_GetClassName(IDirect3DRMTexture3 *iface, DWORD *size, char *name) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_class_name(&texture->obj, size, name); +} + +static HRESULT WINAPI d3drm_texture3_InitFromFile(IDirect3DRMTexture3 *iface, const char *filename) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + D3DRMIMAGE *image; + HRESULT hr; + + TRACE("iface %p, filename %s.\n", iface, debugstr_a(filename)); + + if (FAILED(hr = d3drm_texture_load(texture, filename, TRUE, &image))) + return hr; + + return IDirect3DRMTexture3_InitFromImage(iface, image); +} + +static HRESULT WINAPI d3drm_texture3_InitFromSurface(IDirect3DRMTexture3 *iface, + IDirectDrawSurface *surface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p, surface %p.\n", iface, surface); + + if (!surface) + return D3DRMERR_BADOBJECT; + + /* d3drm intentionally leaks a reference to IDirect3DRM here if texture has already been initialized. */ + IDirect3DRM_AddRef(texture->d3drm); + + if (texture->image || texture->surface) + return D3DRMERR_BADOBJECT; + + texture->surface = surface; + IDirectDrawSurface_AddRef(texture->surface); + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_texture3_InitFromResource(IDirect3DRMTexture3 *iface, HRSRC resource) +{ + FIXME("iface %p, resource %p stub!\n", iface, resource); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture3_Changed(IDirect3DRMTexture3 *iface, + DWORD flags, DWORD rect_count, RECT *rects) +{ + FIXME("iface %p, flags %#lx, rect_count %lu, rects %p stub!\n", iface, flags, rect_count, rects); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture3_SetColors(IDirect3DRMTexture3 *iface, DWORD max_colors) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + TRACE("iface %p, max_colors %lu\n", iface, max_colors); + + texture->max_colors= max_colors; + + return S_OK; +} + +static HRESULT WINAPI d3drm_texture3_SetShades(IDirect3DRMTexture3 *iface, DWORD max_shades) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + TRACE("iface %p, max_shades %lu\n", iface, max_shades); + + texture->max_shades = max_shades; + + return S_OK; +} + +static HRESULT WINAPI d3drm_texture3_SetDecalSize(IDirect3DRMTexture3 *iface, D3DVALUE width, D3DVALUE height) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p, width %.8e, height %.8e.\n", iface, width, height); + + texture->decal_width = width; + texture->decal_height = height; + + return S_OK; +} + +static HRESULT WINAPI d3drm_texture3_SetDecalOrigin(IDirect3DRMTexture3 *iface, LONG x, LONG y) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p, x %ld, y %ld\n", iface, x, y); + + texture->decal_x = x; + texture->decal_y = y; + + return S_OK; +} + +static HRESULT WINAPI d3drm_texture3_SetDecalScale(IDirect3DRMTexture3 *iface, DWORD scale) +{ + FIXME("iface %p, scale %lu stub!\n", iface, scale); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture3_SetDecalTransparency(IDirect3DRMTexture3 *iface, BOOL transparency) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p, transparency %#x.\n", iface, transparency); + + texture->transparency = transparency; + + return S_OK; +} + +static HRESULT WINAPI d3drm_texture3_SetDecalTransparentColor(IDirect3DRMTexture3 *iface, D3DCOLOR color) +{ + FIXME("iface %p, color 0x%08lx stub!\n", iface, color); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture3_GetDecalSize(IDirect3DRMTexture3 *iface, D3DVALUE *width, D3DVALUE *height) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p, width %p, height %p.\n", iface, width, height); + + *width = texture->decal_width; + *height = texture->decal_height; + + return S_OK; +} + +static HRESULT WINAPI d3drm_texture3_GetDecalOrigin(IDirect3DRMTexture3 *iface, LONG *x, LONG *y) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p, x %p, y %p\n", iface, x, y); + + *x = texture->decal_x; + *y = texture->decal_y; + + return S_OK; +} + +static D3DRMIMAGE * WINAPI d3drm_texture3_GetImage(IDirect3DRMTexture3 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p.\n", iface); + + return texture->image; +} + +static DWORD WINAPI d3drm_texture3_GetShades(IDirect3DRMTexture3 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + TRACE("iface %p\n", iface); + return texture->max_shades; +} + +static DWORD WINAPI d3drm_texture3_GetColors(IDirect3DRMTexture3 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + TRACE("iface %p\n", iface); + return texture->max_colors; +} + +static DWORD WINAPI d3drm_texture3_GetDecalScale(IDirect3DRMTexture3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return 0; +} + +static BOOL WINAPI d3drm_texture3_GetDecalTransparency(IDirect3DRMTexture3 *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p.\n", iface); + + return texture->transparency; +} + +static D3DCOLOR WINAPI d3drm_texture3_GetDecalTransparentColor(IDirect3DRMTexture3 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return 0; +} + +static HRESULT WINAPI d3drm_texture3_InitFromImage(IDirect3DRMTexture3 *iface, D3DRMIMAGE *image) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p, image %p.\n", iface, image); + + if (!d3drm_validate_image(image)) + return D3DRMERR_BADOBJECT; + + /* d3drm intentionally leaks a reference to IDirect3DRM here if texture has already been initialized. */ + IDirect3DRM_AddRef(texture->d3drm); + + if (texture->image || texture->surface) + return D3DRMERR_BADOBJECT; + + texture->image = image; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_texture3_InitFromResource2(IDirect3DRMTexture3 *iface, + HMODULE module, const char *name, const char *type) +{ + FIXME("iface %p, module %p, name %s, type %s stub!\n", + iface, module, debugstr_a(name), debugstr_a(type)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture3_GenerateMIPMap(IDirect3DRMTexture3 *iface, DWORD flags) +{ + FIXME("iface %p, flags %#lx stub!\n", iface, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture3_GetSurface(IDirect3DRMTexture3 *iface, + DWORD flags, IDirectDrawSurface **surface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + + TRACE("iface %p, flags %#lx, surface %p.\n", iface, flags, surface); + + if (flags) + FIXME("unexpected flags %#lx.\n", flags); + + if (!surface) + return D3DRMERR_BADVALUE; + + if (texture->image) + return D3DRMERR_NOTCREATEDFROMDDS; + + *surface = texture->surface; + IDirectDrawSurface_AddRef(*surface); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_texture3_SetCacheOptions(IDirect3DRMTexture3 *iface, LONG importance, DWORD flags) +{ + FIXME("iface %p, importance %ld, flags %#lx stub!\n", iface, importance, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture3_GetCacheOptions(IDirect3DRMTexture3 *iface, + LONG *importance, DWORD *flags) +{ + FIXME("iface %p, importance %p, flags %p stub!\n", iface, importance, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture3_SetDownsampleCallback(IDirect3DRMTexture3 *iface, + D3DRMDOWNSAMPLECALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture3_SetValidationCallback(IDirect3DRMTexture3 *iface, + D3DRMVALIDATIONCALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static const struct IDirect3DRMTexture3Vtbl d3drm_texture3_vtbl = +{ + d3drm_texture3_QueryInterface, + d3drm_texture3_AddRef, + d3drm_texture3_Release, + d3drm_texture3_Clone, + d3drm_texture3_AddDestroyCallback, + d3drm_texture3_DeleteDestroyCallback, + d3drm_texture3_SetAppData, + d3drm_texture3_GetAppData, + d3drm_texture3_SetName, + d3drm_texture3_GetName, + d3drm_texture3_GetClassName, + d3drm_texture3_InitFromFile, + d3drm_texture3_InitFromSurface, + d3drm_texture3_InitFromResource, + d3drm_texture3_Changed, + d3drm_texture3_SetColors, + d3drm_texture3_SetShades, + d3drm_texture3_SetDecalSize, + d3drm_texture3_SetDecalOrigin, + d3drm_texture3_SetDecalScale, + d3drm_texture3_SetDecalTransparency, + d3drm_texture3_SetDecalTransparentColor, + d3drm_texture3_GetDecalSize, + d3drm_texture3_GetDecalOrigin, + d3drm_texture3_GetImage, + d3drm_texture3_GetShades, + d3drm_texture3_GetColors, + d3drm_texture3_GetDecalScale, + d3drm_texture3_GetDecalTransparency, + d3drm_texture3_GetDecalTransparentColor, + d3drm_texture3_InitFromImage, + d3drm_texture3_InitFromResource2, + d3drm_texture3_GenerateMIPMap, + d3drm_texture3_GetSurface, + d3drm_texture3_SetCacheOptions, + d3drm_texture3_GetCacheOptions, + d3drm_texture3_SetDownsampleCallback, + d3drm_texture3_SetValidationCallback, +}; + +HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm) +{ + static const char classname[] = "Texture"; + struct d3drm_texture *object; + + TRACE("texture %p.\n", texture); + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IDirect3DRMTexture_iface.lpVtbl = &d3drm_texture1_vtbl; + object->IDirect3DRMTexture2_iface.lpVtbl = &d3drm_texture2_vtbl; + object->IDirect3DRMTexture3_iface.lpVtbl = &d3drm_texture3_vtbl; + object->d3drm = d3drm; + object->max_colors = 8; + object->max_shades = 16; + object->transparency = FALSE; + object->decal_width = 1.0f; + object->decal_height = 1.0f; + + d3drm_object_init(&object->obj, classname); + + *texture = object; + + return D3DRM_OK; +} diff --git a/3rdparty/d3drm/version.rc b/3rdparty/d3drm/version.rc new file mode 100644 index 00000000..a9ce437b --- /dev/null +++ b/3rdparty/d3drm/version.rc @@ -0,0 +1,26 @@ +/* + * Copyright 2004 Ivan Leo Puoti + * + * 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 + */ + +#define WINE_FILEDESCRIPTION_STR "Wine Direct3D Retained Mode Utility Functions" +#define WINE_FILENAME_STR "d3drm.dll" +#define WINE_FILEVERSION 5,0,2134,14 +#define WINE_FILEVERSION_STR "5.0.2134.14" +#define WINE_PRODUCTVERSION 5,0,2134,14 +#define WINE_PRODUCTVERSION_STR "5.0" + +#include "wine/wine_common_ver.rc" diff --git a/3rdparty/d3drm/viewport.c b/3rdparty/d3drm/viewport.c new file mode 100644 index 00000000..821eb1ff --- /dev/null +++ b/3rdparty/d3drm/viewport.c @@ -0,0 +1,1147 @@ +/* + * Implementation of IDirect3DRMViewport Interface + * + * Copyright 2012 André Hentschel + * + * 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 + */ + +#include "d3drm_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d3drm); + +static inline struct d3drm_viewport *impl_from_IDirect3DRMViewport(IDirect3DRMViewport *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_viewport, IDirect3DRMViewport_iface); +} + +static inline struct d3drm_viewport *impl_from_IDirect3DRMViewport2(IDirect3DRMViewport2 *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_viewport, IDirect3DRMViewport2_iface); +} + +static inline void d3drm_normalize_d3d_color(D3DCOLORVALUE *color_value, D3DCOLOR color) +{ + color_value->r = RGBA_GETRED(color) / 255.0f; + color_value->g = RGBA_GETGREEN(color) / 255.0f; + color_value->b = RGBA_GETBLUE(color) / 255.0f; + color_value->a = RGBA_GETALPHA(color) / 255.0f; +} + +static HRESULT d3drm_update_background_material(struct d3drm_viewport *viewport) +{ + IDirect3DRMFrame *root_frame; + D3DCOLOR color; + D3DMATERIAL mat; + HRESULT hr; + + if (FAILED(hr = IDirect3DRMFrame_GetScene(viewport->camera, &root_frame))) + return hr; + color = IDirect3DRMFrame_GetSceneBackground(root_frame); + IDirect3DRMFrame_Release(root_frame); + + memset(&mat, 0, sizeof(mat)); + mat.dwSize = sizeof(mat); + d3drm_normalize_d3d_color(&mat.diffuse, color); + + return IDirect3DMaterial_SetMaterial(viewport->material, &mat); +} + +static void d3drm_viewport_destroy(struct d3drm_viewport *viewport) +{ + TRACE("viewport %p releasing attached interfaces.\n", viewport); + + d3drm_object_cleanup((IDirect3DRMObject *)&viewport->IDirect3DRMViewport_iface, &viewport->obj); + + if (viewport->d3d_viewport) + { + IDirect3DViewport_Release(viewport->d3d_viewport); + IDirect3DMaterial_Release(viewport->material); + IDirect3DRMFrame_Release(viewport->camera); + IDirect3DRM_Release(viewport->d3drm); + } + + free(viewport); +} + +static HRESULT WINAPI d3drm_viewport2_QueryInterface(IDirect3DRMViewport2 *iface, REFIID riid, void **out) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRMViewport) + || IsEqualGUID(riid, &IID_IDirect3DRMObject) + || IsEqualGUID(riid, &IID_IUnknown)) + { + *out = &viewport->IDirect3DRMViewport_iface; + } + else if (IsEqualGUID(riid, &IID_IDirect3DRMViewport2)) + { + *out = &viewport->IDirect3DRMViewport2_iface; + } + else + { + *out = NULL; + WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid)); + return CLASS_E_CLASSNOTAVAILABLE; + } + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} + +static HRESULT WINAPI d3drm_viewport1_QueryInterface(IDirect3DRMViewport *iface, REFIID riid, void **out) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + return d3drm_viewport2_QueryInterface(&viewport->IDirect3DRMViewport2_iface, riid, out); +} + +static ULONG WINAPI d3drm_viewport2_AddRef(IDirect3DRMViewport2 *iface) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + ULONG refcount = InterlockedIncrement(&viewport->obj.ref); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI d3drm_viewport1_AddRef(IDirect3DRMViewport *iface) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_viewport2_AddRef(&viewport->IDirect3DRMViewport2_iface); +} + +static ULONG WINAPI d3drm_viewport2_Release(IDirect3DRMViewport2 *iface) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + ULONG refcount = InterlockedDecrement(&viewport->obj.ref); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + d3drm_viewport_destroy(viewport); + + return refcount; +} + +static ULONG WINAPI d3drm_viewport1_Release(IDirect3DRMViewport *iface) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_viewport2_Release(&viewport->IDirect3DRMViewport2_iface); +} + +static HRESULT WINAPI d3drm_viewport2_Clone(IDirect3DRMViewport2 *iface, + IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_viewport1_Clone(IDirect3DRMViewport *iface, + IUnknown *outer, REFIID iid, void **out) +{ + FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_viewport2_AddDestroyCallback(IDirect3DRMViewport2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx); + + return d3drm_object_add_destroy_callback(&viewport->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_viewport1_AddDestroyCallback(IDirect3DRMViewport *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx); + + return d3drm_viewport2_AddDestroyCallback(&viewport->IDirect3DRMViewport2_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_viewport2_DeleteDestroyCallback(IDirect3DRMViewport2 *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx); + + return d3drm_object_delete_destroy_callback(&viewport->obj, cb, ctx); +} + +static HRESULT WINAPI d3drm_viewport1_DeleteDestroyCallback(IDirect3DRMViewport *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx); + + return d3drm_viewport2_DeleteDestroyCallback(&viewport->IDirect3DRMViewport2_iface, cb, ctx); +} + +static HRESULT WINAPI d3drm_viewport2_SetAppData(IDirect3DRMViewport2 *iface, DWORD data) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, data %#lx\n", iface, data); + + viewport->obj.appdata = data; + return S_OK; +} + +static HRESULT WINAPI d3drm_viewport1_SetAppData(IDirect3DRMViewport *iface, DWORD data) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p, data %#lx\n", iface, data); + + return d3drm_viewport2_SetAppData(&viewport->IDirect3DRMViewport2_iface, data); +} + +static DWORD WINAPI d3drm_viewport2_GetAppData(IDirect3DRMViewport2 *iface) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p\n", iface); + + return viewport->obj.appdata; +} + +static DWORD WINAPI d3drm_viewport1_GetAppData(IDirect3DRMViewport *iface) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_viewport2_GetAppData(&viewport->IDirect3DRMViewport2_iface); +} + +static HRESULT WINAPI d3drm_viewport2_SetName(IDirect3DRMViewport2 *iface, const char *name) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_object_set_name(&viewport->obj, name); +} + +static HRESULT WINAPI d3drm_viewport1_SetName(IDirect3DRMViewport *iface, const char *name) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return d3drm_viewport2_SetName(&viewport->IDirect3DRMViewport2_iface, name); +} + +static HRESULT WINAPI d3drm_viewport2_GetName(IDirect3DRMViewport2 *iface, DWORD *size, char *name) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_name(&viewport->obj, size, name); +} + +static HRESULT WINAPI d3drm_viewport1_GetName(IDirect3DRMViewport *iface, DWORD *size, char *name) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_viewport2_GetName(&viewport->IDirect3DRMViewport2_iface, size, name); +} + +static HRESULT WINAPI d3drm_viewport2_GetClassName(IDirect3DRMViewport2 *iface, DWORD *size, char *name) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_object_get_class_name(&viewport->obj, size, name); +} + +static HRESULT WINAPI d3drm_viewport1_GetClassName(IDirect3DRMViewport *iface, DWORD *size, char *name) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return d3drm_viewport2_GetClassName(&viewport->IDirect3DRMViewport2_iface, size, name); +} + +static HRESULT WINAPI d3drm_viewport2_Init(IDirect3DRMViewport2 *iface, IDirect3DRMDevice3 *device, + IDirect3DRMFrame3 *camera, DWORD x, DWORD y, DWORD width, DWORD height) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + struct d3drm_device *device_obj = unsafe_impl_from_IDirect3DRMDevice3(device); + D3DVIEWPORT vp; + D3DVALUE scale; + IDirect3D *d3d1 = NULL; + IDirect3DDevice *d3d_device = NULL; + IDirect3DMaterial *material = NULL; + D3DMATERIALHANDLE hmat; + HRESULT hr = D3DRM_OK; + + TRACE("iface %p, device %p, camera %p, x %lu, y %lu, width %lu, height %lu.\n", + iface, device, camera, x, y, width, height); + + if (!device_obj || !camera + || width > device_obj->width + || height > device_obj->height) + { + return D3DRMERR_BADOBJECT; + } + + if (viewport->d3d_viewport) + return D3DRMERR_BADOBJECT; + + IDirect3DRM_AddRef(viewport->d3drm); + + if (FAILED(hr = IDirect3DRMDevice3_GetDirect3DDevice(device, &d3d_device))) + goto cleanup; + + if (FAILED(hr = IDirect3DDevice_GetDirect3D(d3d_device, &d3d1))) + goto cleanup; + + if (FAILED(hr = IDirect3D_CreateViewport(d3d1, &viewport->d3d_viewport, NULL))) + goto cleanup; + + if (FAILED(hr = IDirect3DDevice_AddViewport(d3d_device, viewport->d3d_viewport))) + goto cleanup; + + vp.dwSize = sizeof(vp); + vp.dwWidth = width; + vp.dwHeight = height; + vp.dwX = x; + vp.dwY = y; + scale = width > height ? (float)width / 2.0f : (float)height / 2.0f; + vp.dvScaleX = scale; + vp.dvScaleY = scale; + vp.dvMaxX = vp.dwWidth / (2.0f * vp.dvScaleX); + vp.dvMaxY = vp.dwHeight / (2.0f * vp.dvScaleY); + vp.dvMinZ = 0.0f; + vp.dvMaxZ = 1.0f; + + if (FAILED(hr = IDirect3DViewport_SetViewport(viewport->d3d_viewport, &vp))) + goto cleanup; + + if (FAILED(hr = IDirect3DRMFrame3_QueryInterface(camera, &IID_IDirect3DRMFrame, (void **)&viewport->camera))) + goto cleanup; + + if (FAILED(hr = IDirect3D_CreateMaterial(d3d1, &material, NULL))) + goto cleanup; + + if (FAILED(hr = IDirect3DMaterial_GetHandle(material, d3d_device, &hmat))) + goto cleanup; + + hr = IDirect3DViewport_SetBackground(viewport->d3d_viewport, hmat); + viewport->material = material; + viewport->device = device_obj; + + viewport->clip.left = -0.5f; + viewport->clip.top = 0.5f; + viewport->clip.right = 0.5f; + viewport->clip.bottom = -0.5f; + viewport->clip.front = 1.0f; + viewport->clip.back = 100.0f; + +cleanup: + + if (FAILED(hr)) + { + if (viewport->d3d_viewport) + { + IDirect3DViewport_Release(viewport->d3d_viewport); + viewport->d3d_viewport = NULL; + } + if (viewport->camera) + IDirect3DRMFrame_Release(viewport->camera); + if (material) + IDirect3DMaterial_Release(material); + IDirect3DRM_Release(viewport->d3drm); + } + if (d3d_device) + IDirect3DDevice_Release(d3d_device); + if (d3d1) + IDirect3D_Release(d3d1); + + return hr; +} + +static HRESULT WINAPI d3drm_viewport1_Init(IDirect3DRMViewport *iface, IDirect3DRMDevice *device, + IDirect3DRMFrame *camera, DWORD x, DWORD y, DWORD width, DWORD height) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + struct d3drm_frame *frame = unsafe_impl_from_IDirect3DRMFrame(camera); + IDirect3DRMDevice3 *device3; + HRESULT hr; + + TRACE("iface %p, device %p, camera %p, x %lu, y %lu, width %lu, height %lu.\n", + iface, device, camera, x, y, width, height); + + if (!device || !frame) + return D3DRMERR_BADOBJECT; + + if (FAILED(hr = IDirect3DRMDevice_QueryInterface(device, &IID_IDirect3DRMDevice3, (void **)&device3))) + return hr; + + hr = d3drm_viewport2_Init(&viewport->IDirect3DRMViewport2_iface, device3, &frame->IDirect3DRMFrame3_iface, + x, y, width, height); + IDirect3DRMDevice3_Release(device3); + + return hr; +} + +static HRESULT WINAPI d3drm_viewport2_Clear(IDirect3DRMViewport2 *iface, DWORD flags) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + DDSCAPS caps = { DDSCAPS_ZBUFFER }; + HRESULT hr; + D3DRECT clear_rect; + IDirectDrawSurface *ds; + DWORD clear_flags = 0; + + TRACE("iface %p, flags %#lx.\n", iface, flags); + + clear_rect.x1 = clear_rect.y1 = 0; + clear_rect.x2 = viewport->device->width; + clear_rect.y2 = viewport->device->height; + + if (flags & D3DRMCLEAR_TARGET) + { + clear_flags |= D3DCLEAR_TARGET; + d3drm_update_background_material(viewport); + } + if (flags & D3DRMCLEAR_ZBUFFER) + { + hr = IDirectDrawSurface_GetAttachedSurface(viewport->device->render_target, &caps, &ds); + if (SUCCEEDED(hr)) + { + clear_flags |= D3DCLEAR_ZBUFFER; + IDirectDrawSurface_Release(ds); + } + } + if (flags & D3DRMCLEAR_DIRTYRECTS) + FIXME("Flag D3DRMCLEAR_DIRTYRECT not implemented yet.\n"); + + if (FAILED(hr = IDirect3DViewport_Clear(viewport->d3d_viewport, 1, &clear_rect, clear_flags))) + return hr; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_viewport1_Clear(IDirect3DRMViewport *iface) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_viewport2_Clear(&viewport->IDirect3DRMViewport2_iface, D3DRMCLEAR_ALL); +} + +static HRESULT WINAPI d3drm_viewport2_Render(IDirect3DRMViewport2 *iface, IDirect3DRMFrame3 *frame) +{ + FIXME("iface %p, frame %p stub!\n", iface, frame); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_viewport1_Render(IDirect3DRMViewport *iface, IDirect3DRMFrame *frame) +{ + FIXME("iface %p, frame %p stub!\n", iface, frame); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_viewport2_SetFront(IDirect3DRMViewport2 *iface, D3DVALUE front) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, front %.8e.\n", iface, front); + + if (!viewport->d3d_viewport) + return D3DRMERR_BADOBJECT; + + if (front <= 0.0f) + return D3DRMERR_BADVALUE; + + viewport->clip.front = front; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_viewport1_SetFront(IDirect3DRMViewport *iface, D3DVALUE front) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p, front %.8e.\n", iface, front); + + return d3drm_viewport2_SetFront(&viewport->IDirect3DRMViewport2_iface, front); +} + +static HRESULT WINAPI d3drm_viewport2_SetBack(IDirect3DRMViewport2 *iface, D3DVALUE back) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, back %.8e.\n", iface, back); + + if (!viewport->d3d_viewport) + return D3DRMERR_BADOBJECT; + + if (back <= viewport->clip.front) + return D3DRMERR_BADVALUE; + + viewport->clip.back = back; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_viewport1_SetBack(IDirect3DRMViewport *iface, D3DVALUE back) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p, back %.8e.\n", iface, back); + + return d3drm_viewport2_SetBack(&viewport->IDirect3DRMViewport2_iface, back); +} + +static HRESULT WINAPI d3drm_viewport2_SetField(IDirect3DRMViewport2 *iface, D3DVALUE field) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, field %.8e.\n", iface, field); + + if (!viewport->d3d_viewport) + return D3DRMERR_BADOBJECT; + + if (field <= 0.0f) + return D3DRMERR_BADVALUE; + + viewport->clip.left = -field; + viewport->clip.right = field; + viewport->clip.bottom = -field; + viewport->clip.top = field; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_viewport1_SetField(IDirect3DRMViewport *iface, D3DVALUE field) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p, field %.8e.\n", iface, field); + + return d3drm_viewport2_SetField(&viewport->IDirect3DRMViewport2_iface, field); +} + +static HRESULT WINAPI d3drm_viewport2_SetUniformScaling(IDirect3DRMViewport2 *iface, BOOL b) +{ + FIXME("iface %p, b %#x stub!\n", iface, b); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_viewport1_SetUniformScaling(IDirect3DRMViewport *iface, BOOL b) +{ + FIXME("iface %p, b %#x stub!\n", iface, b); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_viewport2_SetCamera(IDirect3DRMViewport2 *iface, IDirect3DRMFrame3 *camera) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + struct d3drm_frame *frame = unsafe_impl_from_IDirect3DRMFrame3(camera); + + TRACE("iface %p, camera %p.\n", iface, camera); + + if (!camera || !viewport->camera) + return D3DRMERR_BADOBJECT; + + IDirect3DRMFrame_AddRef(&frame->IDirect3DRMFrame_iface); + IDirect3DRMFrame_Release(viewport->camera); + viewport->camera = &frame->IDirect3DRMFrame_iface; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_viewport1_SetCamera(IDirect3DRMViewport *iface, IDirect3DRMFrame *camera) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + struct d3drm_frame *frame = unsafe_impl_from_IDirect3DRMFrame(camera); + + TRACE("iface %p, camera %p.\n", iface, camera); + + return d3drm_viewport2_SetCamera(&viewport->IDirect3DRMViewport2_iface, + frame ? &frame->IDirect3DRMFrame3_iface : NULL); +} + +static HRESULT WINAPI d3drm_viewport2_SetProjection(IDirect3DRMViewport2 *iface, D3DRMPROJECTIONTYPE type) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, type %#x.\n", iface, type); + + if (!viewport->d3d_viewport) + return D3DRMERR_BADOBJECT; + + viewport->projection = type; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_viewport1_SetProjection(IDirect3DRMViewport *iface, D3DRMPROJECTIONTYPE type) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p, type %#x.\n", iface, type); + + return d3drm_viewport2_SetProjection(&viewport->IDirect3DRMViewport2_iface, type); +} + +static HRESULT WINAPI d3drm_viewport2_Transform(IDirect3DRMViewport2 *iface, D3DRMVECTOR4D *d, D3DVECTOR *s) +{ + FIXME("iface %p, d %p, s %p stub!\n", iface, d, s); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_viewport1_Transform(IDirect3DRMViewport *iface, D3DRMVECTOR4D *d, D3DVECTOR *s) +{ + FIXME("iface %p, d %p, s %p stub!\n", iface, d, s); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_viewport2_InverseTransform(IDirect3DRMViewport2 *iface, D3DVECTOR *d, D3DRMVECTOR4D *s) +{ + FIXME("iface %p, d %p, s %p stub!\n", iface, d, s); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_viewport1_InverseTransform(IDirect3DRMViewport *iface, D3DVECTOR *d, D3DRMVECTOR4D *s) +{ + FIXME("iface %p, d %p, s %p stub!\n", iface, d, s); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_viewport2_Configure(IDirect3DRMViewport2 *iface, + LONG x, LONG y, DWORD width, DWORD height) +{ + FIXME("iface %p, x %ld, y %ld, width %lu, height %lu stub!\n", iface, x, y, width, height); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_viewport1_Configure(IDirect3DRMViewport *iface, + LONG x, LONG y, DWORD width, DWORD height) +{ + FIXME("iface %p, x %ld, y %ld, width %lu, height %lu stub!\n", iface, x, y, width, height); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_viewport2_ForceUpdate(IDirect3DRMViewport2* iface, + DWORD x1, DWORD y1, DWORD x2, DWORD y2) +{ + FIXME("iface %p, x1 %lu, y1 %lu, x2 %lu, y2 %lu stub!\n", iface, x1, y1, x2, y2); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_viewport1_ForceUpdate(IDirect3DRMViewport *iface, + DWORD x1, DWORD y1, DWORD x2, DWORD y2) +{ + FIXME("iface %p, x1 %lu, y1 %lu, x2 %lu, y2 %lu stub!\n", iface, x1, y1, x2, y2); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_viewport2_SetPlane(IDirect3DRMViewport2 *iface, + D3DVALUE left, D3DVALUE right, D3DVALUE bottom, D3DVALUE top) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, left %.8e, right %.8e, bottom %.8e, top %.8e.\n", + iface, left, right, bottom, top); + + if (!viewport->d3d_viewport) + return D3DRMERR_BADOBJECT; + + viewport->clip.left = left; + viewport->clip.right = right; + viewport->clip.bottom = bottom; + viewport->clip.top = top; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_viewport1_SetPlane(IDirect3DRMViewport *iface, + D3DVALUE left, D3DVALUE right, D3DVALUE bottom, D3DVALUE top) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p, left %.8e, right %.8e, bottom %.8e, top %.8e.\n", + iface, left, right, bottom, top); + + return d3drm_viewport2_SetPlane(&viewport->IDirect3DRMViewport2_iface, left, right, bottom, top); +} + +static HRESULT WINAPI d3drm_viewport2_GetCamera(IDirect3DRMViewport2 *iface, IDirect3DRMFrame3 **camera) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, camera %p.\n", iface, camera); + + if (!camera) + return D3DRMERR_BADVALUE; + + if (!viewport->camera) + return D3DRMERR_BADOBJECT; + + return IDirect3DRMFrame_QueryInterface(viewport->camera, &IID_IDirect3DRMFrame3, (void **)camera); +} + +static HRESULT WINAPI d3drm_viewport1_GetCamera(IDirect3DRMViewport *iface, IDirect3DRMFrame **camera) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + struct d3drm_frame *camera_impl; + IDirect3DRMFrame3 *camera3; + HRESULT hr; + + TRACE("iface %p, camera %p.\n", iface, camera); + + if (!camera) + return D3DRMERR_BADVALUE; + + if (FAILED(hr = d3drm_viewport2_GetCamera(&viewport->IDirect3DRMViewport2_iface, &camera3))) + return hr; + + camera_impl = unsafe_impl_from_IDirect3DRMFrame3(camera3); + *camera = &camera_impl->IDirect3DRMFrame_iface; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_viewport2_GetDevice(IDirect3DRMViewport2 *iface, IDirect3DRMDevice3 **device) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, device %p.\n", iface, device); + + if (!device) + return D3DRMERR_BADVALUE; + + if (!viewport->device) + return D3DRMERR_BADOBJECT; + + *device = &viewport->device->IDirect3DRMDevice3_iface; + IDirect3DRMDevice3_AddRef(*device); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_viewport1_GetDevice(IDirect3DRMViewport *iface, IDirect3DRMDevice **device) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p, device %p.\n\n", iface, device); + + if (!device) + return D3DRMERR_BADVALUE; + + if (!viewport->device) + return D3DRMERR_BADOBJECT; + + *device = &viewport->device->IDirect3DRMDevice_iface; + IDirect3DRMDevice_AddRef(*device); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_viewport2_GetPlane(IDirect3DRMViewport2 *iface, + D3DVALUE *left, D3DVALUE *right, D3DVALUE *bottom, D3DVALUE *top) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, left %p, right %p, bottom %p, top %p.\n", + iface, left, right, bottom, top); + + if (!viewport->d3d_viewport) + return D3DRMERR_BADOBJECT; + + *left = viewport->clip.left; + *right = viewport->clip.right; + *bottom = viewport->clip.bottom; + *top = viewport->clip.top; + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_viewport1_GetPlane(IDirect3DRMViewport *iface, + D3DVALUE *left, D3DVALUE *right, D3DVALUE *bottom, D3DVALUE *top) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p, left %p, right %p, bottom %p, top %p.\n", + iface, left, right, bottom, top); + + return d3drm_viewport2_GetPlane(&viewport->IDirect3DRMViewport2_iface, left, right, bottom, top); +} + +static HRESULT WINAPI d3drm_viewport2_Pick(IDirect3DRMViewport2 *iface, + LONG x, LONG y, IDirect3DRMPickedArray **visuals) +{ + FIXME("iface %p, x %ld, y %ld, visuals %p stub!\n", iface, x, y, visuals); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_viewport1_Pick(IDirect3DRMViewport *iface, + LONG x, LONG y, IDirect3DRMPickedArray **visuals) +{ + FIXME("iface %p, x %ld, y %ld, visuals %p stub!\n", iface, x, y, visuals); + + return E_NOTIMPL; +} + +static BOOL WINAPI d3drm_viewport2_GetUniformScaling(IDirect3DRMViewport2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return FALSE; +} + +static BOOL WINAPI d3drm_viewport1_GetUniformScaling(IDirect3DRMViewport *iface) +{ + FIXME("iface %p stub!\n", iface); + + return FALSE; +} + +static LONG WINAPI d3drm_viewport2_GetX(IDirect3DRMViewport2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static LONG WINAPI d3drm_viewport1_GetX(IDirect3DRMViewport *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static LONG WINAPI d3drm_viewport2_GetY(IDirect3DRMViewport2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static LONG WINAPI d3drm_viewport1_GetY(IDirect3DRMViewport *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static DWORD WINAPI d3drm_viewport2_GetWidth(IDirect3DRMViewport2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static DWORD WINAPI d3drm_viewport1_GetWidth(IDirect3DRMViewport *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static DWORD WINAPI d3drm_viewport2_GetHeight(IDirect3DRMViewport2 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static DWORD WINAPI d3drm_viewport1_GetHeight(IDirect3DRMViewport *iface) +{ + FIXME("iface %p stub!\n", iface); + + return E_NOTIMPL; +} + +static D3DVALUE WINAPI d3drm_viewport2_GetField(IDirect3DRMViewport2 *iface) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p.\n", iface); + + if (!viewport->d3d_viewport) + return -1.0f; + + return (viewport->clip.right - viewport->clip.left + + viewport->clip.top - viewport->clip.bottom) / 4.0f; +} + +static D3DVALUE WINAPI d3drm_viewport1_GetField(IDirect3DRMViewport *iface) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_viewport2_GetField(&viewport->IDirect3DRMViewport2_iface); +} + +static D3DVALUE WINAPI d3drm_viewport2_GetBack(IDirect3DRMViewport2 *iface) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p.\n", iface); + + if (!viewport->d3d_viewport) + return -1.0f; + + return viewport->clip.back; +} + +static D3DVALUE WINAPI d3drm_viewport1_GetBack(IDirect3DRMViewport *iface) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_viewport2_GetBack(&viewport->IDirect3DRMViewport2_iface); +} + +static D3DVALUE WINAPI d3drm_viewport2_GetFront(IDirect3DRMViewport2 *iface) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p.\n", iface); + + if (!viewport->d3d_viewport) + return -1.0f; + + return viewport->clip.front; +} + +static D3DVALUE WINAPI d3drm_viewport1_GetFront(IDirect3DRMViewport *iface) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_viewport2_GetFront(&viewport->IDirect3DRMViewport2_iface); +} + +static D3DRMPROJECTIONTYPE WINAPI d3drm_viewport2_GetProjection(IDirect3DRMViewport2 *iface) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p.\n", iface); + + if (!viewport->d3d_viewport) + return ~0u; + + return viewport->projection; +} + +static D3DRMPROJECTIONTYPE WINAPI d3drm_viewport1_GetProjection(IDirect3DRMViewport *iface) +{ + struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p.\n", iface); + + return d3drm_viewport2_GetProjection(&viewport->IDirect3DRMViewport2_iface); +} + +static HRESULT WINAPI d3drm_viewport2_GetDirect3DViewport(IDirect3DRMViewport2 *iface, + IDirect3DViewport **viewport) +{ + struct d3drm_viewport *viewport_object = impl_from_IDirect3DRMViewport2(iface); + + TRACE("iface %p, viewport %p.\n", iface, viewport); + + if (!viewport) + return D3DRMERR_BADVALUE; + + if (!viewport_object->d3d_viewport) + return D3DRMERR_BADOBJECT; + + *viewport = viewport_object->d3d_viewport; + IDirect3DViewport_AddRef(*viewport); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_viewport1_GetDirect3DViewport(IDirect3DRMViewport *iface, + IDirect3DViewport **viewport) +{ + struct d3drm_viewport *viewport_object = impl_from_IDirect3DRMViewport(iface); + + TRACE("iface %p, viewport %p.\n", iface, viewport); + + return d3drm_viewport2_GetDirect3DViewport(&viewport_object->IDirect3DRMViewport2_iface, viewport); +} + +static HRESULT WINAPI d3drm_viewport2_TransformVectors(IDirect3DRMViewport2 *iface, + DWORD vector_count, D3DRMVECTOR4D *dst, D3DVECTOR *src) +{ + FIXME("iface %p, vector_count %lu, dst %p, src %p stub!\n", iface, vector_count, dst, src); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_viewport2_InverseTransformVectors(IDirect3DRMViewport2 *iface, + DWORD vector_count, D3DVECTOR *dst, D3DRMVECTOR4D *src) +{ + FIXME("iface %p, vector_count %lu, dst %p, src %p stub!\n", iface, vector_count, dst, src); + + return E_NOTIMPL; +} + +static const struct IDirect3DRMViewport2Vtbl d3drm_viewport2_vtbl = +{ + d3drm_viewport2_QueryInterface, + d3drm_viewport2_AddRef, + d3drm_viewport2_Release, + d3drm_viewport2_Clone, + d3drm_viewport2_AddDestroyCallback, + d3drm_viewport2_DeleteDestroyCallback, + d3drm_viewport2_SetAppData, + d3drm_viewport2_GetAppData, + d3drm_viewport2_SetName, + d3drm_viewport2_GetName, + d3drm_viewport2_GetClassName, + d3drm_viewport2_Init, + d3drm_viewport2_Clear, + d3drm_viewport2_Render, + d3drm_viewport2_SetFront, + d3drm_viewport2_SetBack, + d3drm_viewport2_SetField, + d3drm_viewport2_SetUniformScaling, + d3drm_viewport2_SetCamera, + d3drm_viewport2_SetProjection, + d3drm_viewport2_Transform, + d3drm_viewport2_InverseTransform, + d3drm_viewport2_Configure, + d3drm_viewport2_ForceUpdate, + d3drm_viewport2_SetPlane, + d3drm_viewport2_GetCamera, + d3drm_viewport2_GetDevice, + d3drm_viewport2_GetPlane, + d3drm_viewport2_Pick, + d3drm_viewport2_GetUniformScaling, + d3drm_viewport2_GetX, + d3drm_viewport2_GetY, + d3drm_viewport2_GetWidth, + d3drm_viewport2_GetHeight, + d3drm_viewport2_GetField, + d3drm_viewport2_GetBack, + d3drm_viewport2_GetFront, + d3drm_viewport2_GetProjection, + d3drm_viewport2_GetDirect3DViewport, + d3drm_viewport2_TransformVectors, + d3drm_viewport2_InverseTransformVectors, +}; + +static const struct IDirect3DRMViewportVtbl d3drm_viewport1_vtbl = +{ + d3drm_viewport1_QueryInterface, + d3drm_viewport1_AddRef, + d3drm_viewport1_Release, + d3drm_viewport1_Clone, + d3drm_viewport1_AddDestroyCallback, + d3drm_viewport1_DeleteDestroyCallback, + d3drm_viewport1_SetAppData, + d3drm_viewport1_GetAppData, + d3drm_viewport1_SetName, + d3drm_viewport1_GetName, + d3drm_viewport1_GetClassName, + d3drm_viewport1_Init, + d3drm_viewport1_Clear, + d3drm_viewport1_Render, + d3drm_viewport1_SetFront, + d3drm_viewport1_SetBack, + d3drm_viewport1_SetField, + d3drm_viewport1_SetUniformScaling, + d3drm_viewport1_SetCamera, + d3drm_viewport1_SetProjection, + d3drm_viewport1_Transform, + d3drm_viewport1_InverseTransform, + d3drm_viewport1_Configure, + d3drm_viewport1_ForceUpdate, + d3drm_viewport1_SetPlane, + d3drm_viewport1_GetCamera, + d3drm_viewport1_GetDevice, + d3drm_viewport1_GetPlane, + d3drm_viewport1_Pick, + d3drm_viewport1_GetUniformScaling, + d3drm_viewport1_GetX, + d3drm_viewport1_GetY, + d3drm_viewport1_GetWidth, + d3drm_viewport1_GetHeight, + d3drm_viewport1_GetField, + d3drm_viewport1_GetBack, + d3drm_viewport1_GetFront, + d3drm_viewport1_GetProjection, + d3drm_viewport1_GetDirect3DViewport, +}; + +HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3drm) +{ + static const char classname[] = "Viewport"; + struct d3drm_viewport *object; + + TRACE("viewport %p, d3drm %p.\n", viewport, d3drm); + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IDirect3DRMViewport_iface.lpVtbl = &d3drm_viewport1_vtbl; + object->IDirect3DRMViewport2_iface.lpVtbl = &d3drm_viewport2_vtbl; + object->d3drm = d3drm; + d3drm_object_init(&object->obj, classname); + + *viewport = object; + + return S_OK; +} diff --git a/3rdparty/d3drm/wine/debug.h b/3rdparty/d3drm/wine/debug.h new file mode 100644 index 00000000..910fab79 --- /dev/null +++ b/3rdparty/d3drm/wine/debug.h @@ -0,0 +1,567 @@ +/* + * Wine debugging interface + * + * Copyright 1999 Patrik Stridvall + * + * 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 + */ + +#if 0 +#pragma makedep install +#endif + +#ifndef __WINE_WINE_DEBUG_H +#define __WINE_WINE_DEBUG_H + +#include +#include +#include +#include +#ifndef GUID_DEFINED +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +struct _GUID; + +/* + * Internal definitions (do not use these directly) + */ + +enum __wine_debug_class +{ + __WINE_DBCL_FIXME, + __WINE_DBCL_ERR, + __WINE_DBCL_WARN, + __WINE_DBCL_TRACE, + + __WINE_DBCL_INIT = 7 /* lazy init flag */ +}; + +struct __wine_debug_channel +{ + unsigned char flags; + char name[15]; +}; + +#ifndef WINE_NO_TRACE_MSGS +# define __WINE_GET_DEBUGGING_TRACE(dbch) ((dbch)->flags & (1 << __WINE_DBCL_TRACE)) +#else +# define __WINE_GET_DEBUGGING_TRACE(dbch) 0 +#endif + +#ifndef WINE_NO_DEBUG_MSGS +# define __WINE_GET_DEBUGGING_WARN(dbch) ((dbch)->flags & (1 << __WINE_DBCL_WARN)) +# define __WINE_GET_DEBUGGING_FIXME(dbch) ((dbch)->flags & (1 << __WINE_DBCL_FIXME)) +#else +# define __WINE_GET_DEBUGGING_WARN(dbch) 0 +# define __WINE_GET_DEBUGGING_FIXME(dbch) 0 +#endif + +/* define error macro regardless of what is configured */ +#define __WINE_GET_DEBUGGING_ERR(dbch) ((dbch)->flags & (1 << __WINE_DBCL_ERR)) + +#define __WINE_GET_DEBUGGING(dbcl,dbch) __WINE_GET_DEBUGGING##dbcl(dbch) + +#define __WINE_IS_DEBUG_ON(dbcl,dbch) \ + (__WINE_GET_DEBUGGING##dbcl(dbch) && (__wine_dbg_get_channel_flags(dbch) & (1 << __WINE_DBCL##dbcl))) + +#define __WINE_DPRINTF(dbcl,dbch) \ + do { if(__WINE_GET_DEBUGGING(dbcl,(dbch))) { \ + struct __wine_debug_channel * const __dbch = (dbch); \ + const enum __wine_debug_class __dbcl = __WINE_DBCL##dbcl; \ + __WINE_DBG_LOG + +#define __WINE_DBG_LOG(...) \ + wine_dbg_log( __dbcl, __dbch, __func__, __VA_ARGS__); } } while(0) + +#if defined(__MINGW32__) || (!defined(__WINE_USE_MSVCRT) && (defined(__GNUC__) || defined(__clang__))) +#define __WINE_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args))) +#else +#define __WINE_PRINTF_ATTR(fmt,args) +#endif + +#ifdef WINE_NO_TRACE_MSGS +#define WINE_TRACE(...) do { } while(0) +#define WINE_TRACE_(ch) WINE_TRACE +#endif + +#ifdef WINE_NO_DEBUG_MSGS +#define WINE_WARN(...) do { } while(0) +#define WINE_WARN_(ch) WINE_WARN +#define WINE_FIXME(...) do { } while(0) +#define WINE_FIXME_(ch) WINE_FIXME +#endif + +NTSYSAPI int WINAPI __wine_dbg_write( const char *str, unsigned int len ); +extern DECLSPEC_EXPORT unsigned char __cdecl __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel ); +extern DECLSPEC_EXPORT const char * __cdecl __wine_dbg_strdup( const char *str ); +extern DECLSPEC_EXPORT int __cdecl __wine_dbg_output( const char *str ); +extern DECLSPEC_EXPORT int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_channel *channel, + const char *function ); + +/* + * Exported definitions and macros + */ + +/* These functions return a printable version of a string, including + quotes. The string will be valid for some time, but not indefinitely + as strings are re-used. */ + +#if (defined(__x86_64__) || (defined(__aarch64__) && __has_attribute(ms_abi))) && defined(__GNUC__) && defined(__WINE_USE_MSVCRT) +# define __wine_dbg_cdecl __cdecl +#else +# define __wine_dbg_cdecl +#endif + +#if 0 +static const char * __wine_dbg_cdecl wine_dbg_vsprintf( const char *format, va_list args ) __WINE_PRINTF_ATTR(1,0); +static inline const char * __wine_dbg_cdecl wine_dbg_vsprintf( const char *format, va_list args ) +{ + char buffer[200]; + + vsnprintf( buffer, sizeof(buffer), format, args ); + return __wine_dbg_strdup( buffer ); +} + +static const char * __wine_dbg_cdecl wine_dbg_sprintf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2); +static inline const char * __wine_dbg_cdecl wine_dbg_sprintf( const char *format, ... ) +{ + const char *ret; + va_list args; + + va_start( args, format ); + ret = wine_dbg_vsprintf( format, args ); + va_end( args ); + return ret; +} + +static int __wine_dbg_cdecl wine_dbg_vprintf( const char *format, va_list args ) __WINE_PRINTF_ATTR(1,0); +static inline int __wine_dbg_cdecl wine_dbg_vprintf( const char *format, va_list args ) +{ + char buffer[1024]; + + vsnprintf( buffer, sizeof(buffer), format, args ); + return __wine_dbg_output( buffer ); +} + +static int __wine_dbg_cdecl wine_dbg_printf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2); +static inline int __wine_dbg_cdecl wine_dbg_printf( const char *format, ... ) +{ + int ret; + va_list args; + + va_start( args, format ); + ret = wine_dbg_vprintf( format, args ); + va_end( args ); + return ret; +} + +static int __wine_dbg_cdecl wine_dbg_vlog( enum __wine_debug_class cls, + struct __wine_debug_channel *channel, const char *func, + const char *format, va_list args ) __WINE_PRINTF_ATTR(4,0); +static inline int __wine_dbg_cdecl wine_dbg_vlog( enum __wine_debug_class cls, + struct __wine_debug_channel *channel, + const char *function, const char *format, va_list args ) +{ + int ret; + + if (*format == '\1') /* special magic to avoid standard prefix */ + { + format++; + function = NULL; + } + if ((ret = __wine_dbg_header( cls, channel, function )) != -1) ret += wine_dbg_vprintf( format, args ); + return ret; +} + +static int __wine_dbg_cdecl wine_dbg_log( enum __wine_debug_class cls, + struct __wine_debug_channel *channel, const char *func, + const char *format, ... ) __WINE_PRINTF_ATTR(4,5); +static inline int __wine_dbg_cdecl wine_dbg_log( enum __wine_debug_class cls, + struct __wine_debug_channel *channel, + const char *function, const char *format, ... ) +{ + va_list args; + int ret; + + va_start( args, format ); + ret = wine_dbg_vlog( cls, channel, function, format, args ); + va_end( args ); + return ret; +} + +static inline const char *wine_dbgstr_an( const char *str, int n ) +{ + static const char hex[16] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; + char buffer[300], *dst = buffer; + + if (!str) return "(null)"; + if (!((ULONG_PTR)str >> 16)) return wine_dbg_sprintf( "#%04x", LOWORD(str) ); +#ifndef WINE_UNIX_LIB + if (IsBadStringPtrA( str, n )) return "(invalid)"; +#endif + if (n == -1) for (n = 0; str[n]; n++) ; + *dst++ = '"'; + while (n-- > 0 && dst <= buffer + sizeof(buffer) - 9) + { + unsigned char c = *str++; + switch (c) + { + case '\n': *dst++ = '\\'; *dst++ = 'n'; break; + case '\r': *dst++ = '\\'; *dst++ = 'r'; break; + case '\t': *dst++ = '\\'; *dst++ = 't'; break; + case '"': *dst++ = '\\'; *dst++ = '"'; break; + case '\\': *dst++ = '\\'; *dst++ = '\\'; break; + default: + if (c < ' ' || c >= 127) + { + *dst++ = '\\'; + *dst++ = 'x'; + *dst++ = hex[(c >> 4) & 0x0f]; + *dst++ = hex[c & 0x0f]; + } + else *dst++ = c; + } + } + *dst++ = '"'; + if (n > 0) + { + *dst++ = '.'; + *dst++ = '.'; + *dst++ = '.'; + } + *dst = 0; + return __wine_dbg_strdup( buffer ); +} + +static inline const char *wine_dbgstr_wn( const WCHAR *str, int n ) +{ + static const char hex[16] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; + char buffer[300], *dst = buffer; + + if (!str) return "(null)"; + if (!((ULONG_PTR)str >> 16)) return wine_dbg_sprintf( "#%04x", LOWORD(str) ); +#ifndef WINE_UNIX_LIB + if (IsBadStringPtrW( str, n )) return "(invalid)"; +#endif + if (n == -1) for (n = 0; str[n]; n++) ; + *dst++ = 'L'; + *dst++ = '"'; + while (n-- > 0 && dst <= buffer + sizeof(buffer) - 10) + { + WCHAR c = *str++; + switch (c) + { + case '\n': *dst++ = '\\'; *dst++ = 'n'; break; + case '\r': *dst++ = '\\'; *dst++ = 'r'; break; + case '\t': *dst++ = '\\'; *dst++ = 't'; break; + case '"': *dst++ = '\\'; *dst++ = '"'; break; + case '\\': *dst++ = '\\'; *dst++ = '\\'; break; + default: + if (c < ' ' || c >= 127) + { + *dst++ = '\\'; + *dst++ = hex[(c >> 12) & 0x0f]; + *dst++ = hex[(c >> 8) & 0x0f]; + *dst++ = hex[(c >> 4) & 0x0f]; + *dst++ = hex[c & 0x0f]; + } + else *dst++ = (char)c; + } + } + *dst++ = '"'; + if (n > 0) + { + *dst++ = '.'; + *dst++ = '.'; + *dst++ = '.'; + } + *dst = 0; + return __wine_dbg_strdup( buffer ); +} + +static inline const char *wine_dbgstr_a( const char *s ) +{ + return wine_dbgstr_an( s, -1 ); +} + +static inline const char *wine_dbgstr_w( const WCHAR *s ) +{ + return wine_dbgstr_wn( s, -1 ); +} + +#if defined(__hstring_h__) && defined(__WINSTRING_H_) +static inline const char *wine_dbgstr_hstring( HSTRING hstr ) +{ + UINT32 len; + const WCHAR *str = WindowsGetStringRawBuffer( hstr, &len ); + return wine_dbgstr_wn( str, len ); +} +#endif + +static inline const char *wine_dbgstr_guid( const GUID *id ) +{ + if (!id) return "(null)"; + if (!((ULONG_PTR)id >> 16)) return wine_dbg_sprintf( "", (WORD)(ULONG_PTR)id ); + return wine_dbg_sprintf( "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + (unsigned int)id->Data1, id->Data2, id->Data3, + id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3], + id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] ); +} + +static inline const char *wine_dbgstr_fourcc( unsigned int fourcc ) +{ + char str[4] = { (char)fourcc, (char)(fourcc >> 8), (char)(fourcc >> 16), (char)(fourcc >> 24) }; + if (!fourcc) + return "''"; + if (isprint( str[0] ) && isprint( str[1] ) && isprint( str[2] ) && isprint( str[3] )) + return wine_dbg_sprintf( "'%.4s'", str ); + return wine_dbg_sprintf( "0x%08x", fourcc ); +} + +static inline const char *wine_dbgstr_point( const POINT *pt ) +{ + if (!pt) return "(null)"; + return wine_dbg_sprintf( "(%d,%d)", (int)pt->x, (int)pt->y ); +} + +static inline const char *wine_dbgstr_rect( const RECT *rect ) +{ + if (!rect) return "(null)"; + return wine_dbg_sprintf( "(%d,%d)-(%d,%d)", (int)rect->left, (int)rect->top, + (int)rect->right, (int)rect->bottom ); +} + +static inline const char *wine_dbgstr_longlong( ULONGLONG ll ) +{ + if (sizeof(ll) > sizeof(unsigned long) && ll >> 32) + return wine_dbg_sprintf( "%lx%08lx", (unsigned long)(ll >> 32), (unsigned long)ll ); + else return wine_dbg_sprintf( "%lx", (unsigned long)ll ); +} + +#if defined(__oaidl_h__) && defined(V_VT) + +static inline const char *wine_dbgstr_vt( VARTYPE vt ) +{ + static const char *const variant_types[] = + { + "VT_EMPTY","VT_NULL","VT_I2","VT_I4","VT_R4","VT_R8","VT_CY","VT_DATE", + "VT_BSTR","VT_DISPATCH","VT_ERROR","VT_BOOL","VT_VARIANT","VT_UNKNOWN", + "VT_DECIMAL","15","VT_I1","VT_UI1","VT_UI2","VT_UI4","VT_I8","VT_UI8", + "VT_INT","VT_UINT","VT_VOID","VT_HRESULT","VT_PTR","VT_SAFEARRAY", + "VT_CARRAY","VT_USERDEFINED","VT_LPSTR","VT_LPWSTR","32","33","34","35", + "VT_RECORD","VT_INT_PTR","VT_UINT_PTR","39","40","41","42","43","44","45", + "46","47","48","49","50","51","52","53","54","55","56","57","58","59","60", + "61","62","63","VT_FILETIME","VT_BLOB","VT_STREAM","VT_STORAGE", + "VT_STREAMED_OBJECT","VT_STORED_OBJECT","VT_BLOB_OBJECT","VT_CF","VT_CLSID", + "VT_VERSIONED_STREAM" + }; + + static const char *const variant_flags[16] = + { + "", + "|VT_VECTOR", + "|VT_ARRAY", + "|VT_VECTOR|VT_ARRAY", + "|VT_BYREF", + "|VT_VECTOR|VT_BYREF", + "|VT_ARRAY|VT_BYREF", + "|VT_VECTOR|VT_ARRAY|VT_BYREF", + "|VT_RESERVED", + "|VT_VECTOR|VT_RESERVED", + "|VT_ARRAY|VT_RESERVED", + "|VT_VECTOR|VT_ARRAY|VT_RESERVED", + "|VT_BYREF|VT_RESERVED", + "|VT_VECTOR|VT_BYREF|VT_RESERVED", + "|VT_ARRAY|VT_BYREF|VT_RESERVED", + "|VT_VECTOR|VT_ARRAY|VT_BYREF|VT_RESERVED", + }; + + if (vt & ~VT_TYPEMASK) + return wine_dbg_sprintf( "%s%s", wine_dbgstr_vt(vt&VT_TYPEMASK), variant_flags[vt>>12] ); + + if (vt < sizeof(variant_types)/sizeof(*variant_types)) + return variant_types[vt]; + + if (vt == VT_BSTR_BLOB) + return "VT_BSTR_BLOB"; + + return wine_dbg_sprintf( "vt(invalid %x)", vt ); +} + +static inline const char *wine_dbgstr_variant( const VARIANT *v ) +{ + if (!v) + return "(null)"; + + if (V_VT(v) & VT_BYREF) { + if (V_VT(v) == (VT_VARIANT|VT_BYREF)) + return wine_dbg_sprintf( "%p {VT_VARIANT|VT_BYREF: %s}", v, wine_dbgstr_variant(V_VARIANTREF(v)) ); + if (V_VT(v) == (VT_BSTR|VT_BYREF)) + return wine_dbg_sprintf( "%p {VT_BSTR|VT_BYREF: %s}", v, V_BSTRREF(v) ? wine_dbgstr_w(*V_BSTRREF(v)) : "(none)" ); + return wine_dbg_sprintf( "%p {%s %p}", v, wine_dbgstr_vt(V_VT(v)), V_BYREF(v) ); + } + + if (V_ISARRAY(v) || V_ISVECTOR(v)) + return wine_dbg_sprintf( "%p {%s %p}", v, wine_dbgstr_vt(V_VT(v)), V_ARRAY(v) ); + + switch(V_VT(v)) { + case VT_EMPTY: + return wine_dbg_sprintf( "%p {VT_EMPTY}", v ); + case VT_NULL: + return wine_dbg_sprintf( "%p {VT_NULL}", v ); + case VT_I2: + return wine_dbg_sprintf( "%p {VT_I2: %d}", v, V_I2(v) ); + case VT_I4: + return wine_dbg_sprintf( "%p {VT_I4: %d}", v, (int)V_I4(v) ); + case VT_R4: + return wine_dbg_sprintf( "%p {VT_R4: %f}", v, V_R4(v) ); + case VT_R8: + return wine_dbg_sprintf( "%p {VT_R8: %lf}", v, V_R8(v) ); + case VT_CY: + return wine_dbg_sprintf( "%p {VT_CY: %s}", v, wine_dbgstr_longlong(V_CY(v).int64) ); + case VT_DATE: + return wine_dbg_sprintf( "%p {VT_DATE: %lf}", v, V_DATE(v) ); + case VT_LPSTR: + return wine_dbg_sprintf( "%p {VT_LPSTR: %s}", v, wine_dbgstr_a((const char *)V_BSTR(v)) ); + case VT_LPWSTR: + return wine_dbg_sprintf( "%p {VT_LPWSTR: %s}", v, wine_dbgstr_w(V_BSTR(v)) ); + case VT_BSTR: + return wine_dbg_sprintf( "%p {VT_BSTR: %s}", v, wine_dbgstr_w(V_BSTR(v)) ); + case VT_DISPATCH: + return wine_dbg_sprintf( "%p {VT_DISPATCH: %p}", v, V_DISPATCH(v) ); + case VT_ERROR: + return wine_dbg_sprintf( "%p {VT_ERROR: %08x}", v, (int)V_ERROR(v) ); + case VT_BOOL: + return wine_dbg_sprintf( "%p {VT_BOOL: %x}", v, V_BOOL(v) ); + case VT_UNKNOWN: + return wine_dbg_sprintf( "%p {VT_UNKNOWN: %p}", v, V_UNKNOWN(v) ); + case VT_I1: + return wine_dbg_sprintf( "%p {VT_I1: %d}", v, V_I1(v) ); + case VT_UI1: + return wine_dbg_sprintf( "%p {VT_UI1: %u}", v, V_UI1(v) ); + case VT_UI2: + return wine_dbg_sprintf( "%p {VT_UI2: %u}", v, V_UI2(v) ); + case VT_UI4: + return wine_dbg_sprintf( "%p {VT_UI4: %u}", v, (unsigned int)V_UI4(v) ); + case VT_I8: + return wine_dbg_sprintf( "%p {VT_I8: %s}", v, wine_dbgstr_longlong(V_I8(v)) ); + case VT_UI8: + return wine_dbg_sprintf( "%p {VT_UI8: %s}", v, wine_dbgstr_longlong(V_UI8(v)) ); + case VT_INT: + return wine_dbg_sprintf( "%p {VT_INT: %d}", v, V_INT(v) ); + case VT_UINT: + return wine_dbg_sprintf( "%p {VT_UINT: %u}", v, V_UINT(v) ); + case VT_VOID: + return wine_dbg_sprintf( "%p {VT_VOID}", v ); + case VT_RECORD: + return wine_dbg_sprintf( "%p {VT_RECORD: %p %p}", v, V_RECORD(v), V_RECORDINFO(v) ); + default: + return wine_dbg_sprintf( "%p {vt %s}", v, wine_dbgstr_vt(V_VT(v)) ); + } +} +#endif + +#endif /* defined(__oaidl_h__) && defined(V_VT) */ + +#ifndef WINE_TRACE +#define WINE_TRACE __WINE_DPRINTF(_TRACE,__wine_dbch___default) +#define WINE_TRACE_(ch) __WINE_DPRINTF(_TRACE,&__wine_dbch_##ch) +#endif +#define WINE_TRACE_ON(ch) __WINE_IS_DEBUG_ON(_TRACE,&__wine_dbch_##ch) + +#ifndef WINE_WARN +#define WINE_WARN __WINE_DPRINTF(_WARN,__wine_dbch___default) +#define WINE_WARN_(ch) __WINE_DPRINTF(_WARN,&__wine_dbch_##ch) +#endif +#define WINE_WARN_ON(ch) __WINE_IS_DEBUG_ON(_WARN,&__wine_dbch_##ch) + +#ifndef WINE_FIXME +#define WINE_FIXME __WINE_DPRINTF(_FIXME,__wine_dbch___default) +#define WINE_FIXME_(ch) __WINE_DPRINTF(_FIXME,&__wine_dbch_##ch) +#endif +#define WINE_FIXME_ON(ch) __WINE_IS_DEBUG_ON(_FIXME,&__wine_dbch_##ch) + +#define WINE_ERR __WINE_DPRINTF(_ERR,__wine_dbch___default) +#define WINE_ERR_(ch) __WINE_DPRINTF(_ERR,&__wine_dbch_##ch) +#define WINE_ERR_ON(ch) __WINE_IS_DEBUG_ON(_ERR,&__wine_dbch_##ch) + +#define WINE_DECLARE_DEBUG_CHANNEL(ch) \ + static struct __wine_debug_channel __wine_dbch_##ch = { 0xff, #ch }; \ + C_ASSERT(sizeof(#ch) <= sizeof(__wine_dbch_##ch.name)) +#define WINE_DEFAULT_DEBUG_CHANNEL(ch) \ + static struct __wine_debug_channel __wine_dbch_##ch = { 0xff, #ch }; \ + C_ASSERT(sizeof(#ch) <= sizeof(__wine_dbch_##ch.name)); \ + static struct __wine_debug_channel * const __wine_dbch___default = &__wine_dbch_##ch + +#define WINE_MESSAGE wine_dbg_printf + +#ifdef __WINESRC__ +/* Wine uses shorter names that are very likely to conflict with other software */ + +#if 0 +static inline const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); } +static inline const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); } +static inline const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); } +static inline const char *debugstr_fourcc( unsigned int cc ) { return wine_dbgstr_fourcc( cc ); } +static inline const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); } +static inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); } + +#if defined(__hstring_h__) && defined(__WINSTRING_H_) +static inline const char *debugstr_hstring( struct HSTRING__ *s ) { return wine_dbgstr_hstring( s ); } +#endif + +#if defined(__oaidl_h__) && defined(V_VT) +static inline const char *debugstr_vt( VARTYPE vt ) { return wine_dbgstr_vt( vt ); } +static inline const char *debugstr_variant( const VARIANT *v ) { return wine_dbgstr_variant( v ); } +#endif +#endif + +#define TRACE WINE_TRACE +#define TRACE_(ch) WINE_TRACE_(ch) +#define TRACE_ON(ch) WINE_TRACE_ON(ch) + +#define WARN WINE_WARN +#define WARN_(ch) WINE_WARN_(ch) +#define WARN_ON(ch) WINE_WARN_ON(ch) + +#define FIXME WINE_FIXME +#define FIXME_(ch) WINE_FIXME_(ch) +#define FIXME_ON(ch) WINE_FIXME_ON(ch) + +#if 0 +#undef ERR /* Solaris got an 'ERR' define in */ +#define ERR WINE_ERR +#define ERR_(ch) WINE_ERR_(ch) +#define ERR_ON(ch) WINE_ERR_ON(ch) +#else +static void ERR(const char *msg) { + /* Do something */ +} +#endif + +#define MESSAGE WINE_MESSAGE + +#endif /* __WINESRC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __WINE_WINE_DEBUG_H */ diff --git a/3rdparty/d3drm/wine/list.h b/3rdparty/d3drm/wine/list.h new file mode 100644 index 00000000..2e1d95f3 --- /dev/null +++ b/3rdparty/d3drm/wine/list.h @@ -0,0 +1,270 @@ +/* + * Linked lists support + * + * Copyright (C) 2002 Alexandre Julliard + * + * 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 __WINE_SERVER_LIST_H +#define __WINE_SERVER_LIST_H + +#include + +struct list +{ + struct list *next; + struct list *prev; +}; + +/* Define a list like so: + * + * struct gadget + * { + * struct list entry; <-- doesn't have to be the first item in the struct + * int a, b; + * }; + * + * static struct list global_gadgets = LIST_INIT( global_gadgets ); + * + * or + * + * struct some_global_thing + * { + * struct list gadgets; + * }; + * + * list_init( &some_global_thing->gadgets ); + * + * Manipulate it like this: + * + * list_add_head( &global_gadgets, &new_gadget->entry ); + * list_remove( &new_gadget->entry ); + * list_add_after( &some_random_gadget->entry, &new_gadget->entry ); + * + * And to iterate over it: + * + * struct gadget *gadget; + * LIST_FOR_EACH_ENTRY( gadget, &global_gadgets, struct gadget, entry ) + * { + * ... + * } + * + */ + +/* add an element after the specified one */ +static inline void list_add_after( struct list *elem, struct list *to_add ) +{ + to_add->next = elem->next; + to_add->prev = elem; + elem->next->prev = to_add; + elem->next = to_add; +} + +/* add an element before the specified one */ +static inline void list_add_before( struct list *elem, struct list *to_add ) +{ + to_add->next = elem; + to_add->prev = elem->prev; + elem->prev->next = to_add; + elem->prev = to_add; +} + +/* add element at the head of the list */ +static inline void list_add_head( struct list *list, struct list *elem ) +{ + list_add_after( list, elem ); +} + +/* add element at the tail of the list */ +static inline void list_add_tail( struct list *list, struct list *elem ) +{ + list_add_before( list, elem ); +} + +/* remove an element from its list */ +static inline void list_remove( struct list *elem ) +{ + elem->next->prev = elem->prev; + elem->prev->next = elem->next; +} + +/* get the next element */ +static inline struct list *list_next( const struct list *list, const struct list *elem ) +{ + struct list *ret = elem->next; + if (elem->next == list) ret = NULL; + return ret; +} + +/* get the previous element */ +static inline struct list *list_prev( const struct list *list, const struct list *elem ) +{ + struct list *ret = elem->prev; + if (elem->prev == list) ret = NULL; + return ret; +} + +/* get the first element */ +static inline struct list *list_head( const struct list *list ) +{ + return list_next( list, list ); +} + +/* get the last element */ +static inline struct list *list_tail( const struct list *list ) +{ + return list_prev( list, list ); +} + +/* check if a list is empty */ +static inline int list_empty( const struct list *list ) +{ + return list->next == list; +} + +/* initialize a list */ +static inline void list_init( struct list *list ) +{ + list->next = list->prev = list; +} + +/* count the elements of a list */ +static inline unsigned int list_count( const struct list *list ) +{ + unsigned count = 0; + const struct list *ptr; + for (ptr = list->next; ptr != list; ptr = ptr->next) count++; + return count; +} + +/* move all elements from src to before the specified element */ +static inline void list_move_before( struct list *dst, struct list *src ) +{ + if (list_empty(src)) return; + + dst->prev->next = src->next; + src->next->prev = dst->prev; + dst->prev = src->prev; + src->prev->next = dst; + list_init(src); +} + +/* move all elements from src to after the specified element */ +static inline void list_move_after( struct list *dst, struct list *src ) +{ + if (list_empty(src)) return; + + dst->next->prev = src->prev; + src->prev->next = dst->next; + dst->next = src->next; + src->next->prev = dst; + list_init(src); +} + +/* move all elements from src to the head of dst */ +static inline void list_move_head( struct list *dst, struct list *src ) +{ + list_move_after( dst, src ); +} + +/* move all elements from src to the tail of dst */ +static inline void list_move_tail( struct list *dst, struct list *src ) +{ + list_move_before( dst, src ); +} + +/* move the slice of elements from begin to end inclusive to the head of dst */ +static inline void list_move_slice_head( struct list *dst, struct list *begin, struct list *end ) +{ + struct list *dst_next = dst->next; + begin->prev->next = end->next; + end->next->prev = begin->prev; + dst->next = begin; + dst_next->prev = end; + begin->prev = dst; + end->next = dst_next; +} + +/* move the slice of elements from begin to end inclusive to the tail of dst */ +static inline void list_move_slice_tail( struct list *dst, struct list *begin, struct list *end ) +{ + struct list *dst_prev = dst->prev; + begin->prev->next = end->next; + end->next->prev = begin->prev; + dst_prev->next = begin; + dst->prev = end; + begin->prev = dst_prev; + end->next = dst; +} + +/* iterate through the list */ +#define LIST_FOR_EACH(cursor,list) \ + for ((cursor) = (list)->next; (cursor) != (list); (cursor) = (cursor)->next) + +/* iterate through the list, with safety against removal */ +#define LIST_FOR_EACH_SAFE(cursor, cursor2, list) \ + for ((cursor) = (list)->next, (cursor2) = (cursor)->next; \ + (cursor) != (list); \ + (cursor) = (cursor2), (cursor2) = (cursor)->next) + +/* iterate through the list using a list entry */ +#define LIST_FOR_EACH_ENTRY(elem, list, type, field) \ + for ((elem) = LIST_ENTRY((list)->next, type, field); \ + &(elem)->field != (list); \ + (elem) = LIST_ENTRY((elem)->field.next, type, field)) + +/* iterate through the list using a list entry, with safety against removal */ +#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field) \ + for ((cursor) = LIST_ENTRY((list)->next, type, field), \ + (cursor2) = LIST_ENTRY((cursor)->field.next, type, field); \ + &(cursor)->field != (list); \ + (cursor) = (cursor2), \ + (cursor2) = LIST_ENTRY((cursor)->field.next, type, field)) + +/* iterate through the list in reverse order */ +#define LIST_FOR_EACH_REV(cursor,list) \ + for ((cursor) = (list)->prev; (cursor) != (list); (cursor) = (cursor)->prev) + +/* iterate through the list in reverse order, with safety against removal */ +#define LIST_FOR_EACH_SAFE_REV(cursor, cursor2, list) \ + for ((cursor) = (list)->prev, (cursor2) = (cursor)->prev; \ + (cursor) != (list); \ + (cursor) = (cursor2), (cursor2) = (cursor)->prev) + +/* iterate through the list in reverse order using a list entry */ +#define LIST_FOR_EACH_ENTRY_REV(elem, list, type, field) \ + for ((elem) = LIST_ENTRY((list)->prev, type, field); \ + &(elem)->field != (list); \ + (elem) = LIST_ENTRY((elem)->field.prev, type, field)) + +/* iterate through the list in reverse order using a list entry, with safety against removal */ +#define LIST_FOR_EACH_ENTRY_SAFE_REV(cursor, cursor2, list, type, field) \ + for ((cursor) = LIST_ENTRY((list)->prev, type, field), \ + (cursor2) = LIST_ENTRY((cursor)->field.prev, type, field); \ + &(cursor)->field != (list); \ + (cursor) = (cursor2), \ + (cursor2) = LIST_ENTRY((cursor)->field.prev, type, field)) + +/* macros for statically initialized lists */ +#undef LIST_INIT +#define LIST_INIT(list) { &(list), &(list) } + +/* get pointer to object containing list element */ +#undef LIST_ENTRY +#define LIST_ENTRY(elem, type, field) \ + ((type *)((char *)(elem) - offsetof(type, field))) + +#endif /* __WINE_SERVER_LIST_H */ diff --git a/3rdparty/d3drm/wine/wine_common_ver.rc b/3rdparty/d3drm/wine/wine_common_ver.rc new file mode 100644 index 00000000..bc6cc7a3 --- /dev/null +++ b/3rdparty/d3drm/wine/wine_common_ver.rc @@ -0,0 +1,152 @@ +/* + * Copyright 2001 Dmitry Timoshkov + * Copyright 2004 Ivan Leo Puoti + * + * 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 + */ + +#if 0 +#pragma makedep header +#endif + +#include "winresrc.h" + +/* +Assign WINE_FILEVERSION and WINE_FILEVERSION_STR high enough number +to make sure that programs, relying on the version numbers, will +never complain. +*/ + +#ifndef WINE_FILEVERSION_MAJOR +#define WINE_FILEVERSION_MAJOR 10 +#endif + +#ifndef WINE_FILEVERSION_MINOR +#define WINE_FILEVERSION_MINOR 0 +#endif + +#ifndef WINE_FILEVERSION_BUILD +#define WINE_FILEVERSION_BUILD 0 +#endif + +#ifndef WINE_FILEVERSION_PLATFORMID +#define WINE_FILEVERSION_PLATFORMID 0 +#endif + +#ifndef WINE_FILEVERSION +#define WINE_FILEVERSION WINE_FILEVERSION_MAJOR,WINE_FILEVERSION_MINOR,\ + WINE_FILEVERSION_BUILD,WINE_FILEVERSION_PLATFORMID +#endif + +#define WINE_VER_STRINGIZE2(x) #x +#define WINE_VER_STRINGIZE(x) WINE_VER_STRINGIZE2(x) +#define WINE_VER_HEXPREFIX2(x) 0x ## x +#define WINE_VER_HEXPREFIX(x) WINE_VER_HEXPREFIX2(x) + +#ifndef WINE_FILEVERSION_STR +#define WINE_FILEVERSION_STR WINE_VER_STRINGIZE(WINE_FILEVERSION_MAJOR.WINE_FILEVERSION_MINOR.WINE_FILEVERSION_BUILD.WINE_FILEVERSION_PLATFORMID) +#endif + +#ifndef WINE_FILEDESCRIPTION_STR +#define WINE_FILEDESCRIPTION_STR "Wine core dll" +#endif + +#ifndef WINE_FILENAME +#define WINE_FILENAME "" +#endif + +#ifndef WINE_FILENAME_STR +#define WINE_FILENAME_STR "" +#endif + +#ifndef WINE_FILETYPE +#define WINE_FILETYPE VFT_DLL +#endif + +#ifndef WINE_FILESUBTYPE +#define WINE_FILESUBTYPE VFT2_UNKNOWN +#endif + +#ifndef WINE_LEGALCOPYRIGHT +#define WINE_LEGALCOPYRIGHT "Copyright (c) 1993-2024 the Wine project authors (see the file AUTHORS for a complete list)" +#endif + +#ifndef WINE_PRODUCTVERSION +#define WINE_PRODUCTVERSION 1,0,0,0 +#endif + +#ifndef WINE_PRODUCTVERSION_STR +#define WINE_PRODUCTVERSION_STR "1.0" +#endif + +#ifndef WINE_PRODUCTNAME_STR +#define WINE_PRODUCTNAME_STR "Wine" +#endif + +#ifndef WINE_EXTRAVALUES +#define WINE_EXTRAVALUES +#endif + +#ifndef WINE_CODEPAGE +#ifdef _WIN32 +#define WINE_CODEPAGE 04B0 /* CP1200 (Unicode) */ +#else +#define WINE_CODEPAGE 04E4 /* CP1252 for Win16 */ +#endif +#endif + +#ifndef WINE_CODEPAGE_STR +#define WINE_CODEPAGE_STR WINE_VER_STRINGIZE(WINE_CODEPAGE) +#endif + +#ifndef WINE_CODEPAGE_HEX +#define WINE_CODEPAGE_HEX WINE_VER_HEXPREFIX(WINE_CODEPAGE) +#endif + +#ifndef WINE_LANGID +#define WINE_LANGID 0409 /* LANG_ENGLISH/SUBLANG_DEFAULT */ +#endif +#define WINE_LANGID_STR WINE_VER_STRINGIZE(WINE_LANGID) +#define WINE_LANGID_HEX WINE_VER_HEXPREFIX(WINE_LANGID) + +VS_VERSION_INFO VERSIONINFO +FILEVERSION WINE_FILEVERSION +PRODUCTVERSION WINE_PRODUCTVERSION +FILEFLAGSMASK 63 +FILEFLAGS 0 +FILEOS VOS_UNKNOWN +FILETYPE WINE_FILETYPE +FILESUBTYPE WINE_FILESUBTYPE +{ + BLOCK "StringFileInfo" + { + BLOCK WINE_LANGID_STR WINE_CODEPAGE_STR + { + VALUE "CompanyName", "Microsoft Corporation" /* GameGuard depends on this */ + VALUE "FileDescription", WINE_FILEDESCRIPTION_STR + VALUE "FileVersion", WINE_FILEVERSION_STR + VALUE "InternalName", WINE_FILENAME + VALUE "LegalCopyright", WINE_LEGALCOPYRIGHT + VALUE "OriginalFilename", WINE_FILENAME_STR + VALUE "ProductName", WINE_PRODUCTNAME_STR + VALUE "ProductVersion", WINE_PRODUCTVERSION_STR + WINE_EXTRAVALUES + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", WINE_LANGID_HEX, WINE_CODEPAGE_HEX + } +} diff --git a/CMakeLists.txt b/CMakeLists.txt index b9e0cc02..9501f2a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15 FATAL_ERROR) +cmake_minimum_required(VERSION 3.25 FATAL_ERROR) # MSVC runtime library flags are selected by an abstraction cmake_policy(SET CMP0091 NEW) @@ -8,6 +8,10 @@ set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) project(isle CXX C) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" CACHE PATH "Directory where to put executables and dll") + # By configuring CMake with -DDOWNLOAD_DEPENDENCIES=ON/OFF, # users can choose between downloading dependencies or using system libraries option(DOWNLOAD_DEPENDENCIES "Download dependencies" TRUE) @@ -38,7 +42,7 @@ else() # to add search paths. find_package(SDL3 CONFIG REQUIRED) - # TODO add iniparser? + find_package(iniparser REQUIRED COMPONENTS static) endif() include(CheckCXXSourceCompiles) @@ -95,53 +99,38 @@ function(add_cxx_warning WARNING) endif() endfunction() +if(NOT MINGW) + set(NOT_MINGW TRUE) +else() + set(NOT_MINGW FALSE) +endif() + +add_subdirectory(3rdparty EXCLUDE_FROM_ALL SYSTEM) + message(STATUS "MSVC for decompilation: ${MSVC_FOR_DECOMP}") option(ISLE_WERROR "Treat warnings as errors" OFF) option(ISLE_BUILD_APP "Build ISLE.EXE application" ON) cmake_dependent_option(ISLE_BUILD_CONFIG "Build CONFIG.EXE application" ON "NOT MINGW" OFF) -option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" ON) -cmake_dependent_option(ISLE_USE_DX5_LIBS "Build with internal DirectX 5 SDK Libraries" ON ISLE_USE_DX5 OFF) +option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" ${NOT_MINGW}) +cmake_dependent_option(ISLE_D3DRM_FROM_WINE "Use d3drm from wine" "${MINGW}" "NOT ISLE_USE_DX5" OFF) + +message(STATUS "Using internal DirectX5 SDK: ${ISLE_USE_DX5}") +message(STATUS "Using d3drm from wine: ${ISLE_D3DRM_FROM_WINE}") add_cxx_warning(parentheses) add_library(DirectX5::DirectX5 INTERFACE IMPORTED) target_include_directories(DirectX5::DirectX5 INTERFACE "${CMAKE_SOURCE_DIR}/3rdparty/dx5/inc") -if(ISLE_USE_DX5_LIBS) +if(ISLE_USE_DX5) target_link_directories(DirectX5::DirectX5 INTERFACE "${CMAKE_SOURCE_DIR}/3rdparty/dx5/lib") endif() +add_subdirectory(3rdparty/d3drm) + add_library(Vec::Vec INTERFACE IMPORTED) target_include_directories(Vec::Vec INTERFACE "${CMAKE_SOURCE_DIR}/3rdparty/vec") -add_library(libsmacker STATIC - 3rdparty/libsmacker/smacker.c -) -register_lego1_target(libsmacker) -set_property(TARGET libsmacker PROPERTY ARCHIVE_OUTPUT_NAME "libsmacker$<$:d>") -set_property(TARGET libsmacker PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/3rdparty/libsmacker") -target_include_directories(libsmacker PRIVATE "${CMAKE_SOURCE_DIR}/3rdparty/libsmacker") - -add_library(miniaudio STATIC - 3rdparty/miniaudio/extras/miniaudio_split/miniaudio.c -) -register_lego1_target(miniaudio) -set_property(TARGET miniaudio PROPERTY ARCHIVE_OUTPUT_NAME "miniaudio$<$:d>") -set_property(TARGET miniaudio PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/3rdparty/miniaudio/extras/miniaudio_split") -target_include_directories(miniaudio PRIVATE "${CMAKE_SOURCE_DIR}/3rdparty/miniaudio/extras/miniaudio_split") -# Disable most features since we don't need them. -target_compile_definitions(miniaudio PUBLIC - MA_ENABLE_ONLY_SPECIFIC_BACKENDS - MA_NO_DECODING - MA_NO_ENCODING - MA_NO_WAV - MA_NO_FLAC - MA_NO_MP3 - MA_NO_DEVICE_IO - MA_NO_RESOURCE_MANAGER - MA_NO_GENERATION - MA_NO_THREADING -) add_library(tglrl STATIC LEGO1/tgl/d3drm/camera.cpp @@ -157,7 +146,11 @@ add_library(tglrl STATIC register_lego1_target(tglrl) set_property(TARGET tglrl PROPERTY ARCHIVE_OUTPUT_NAME "tglrl40$<$:d>") target_include_directories(tglrl PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/util") -target_link_libraries(tglrl PRIVATE d3drm) +if(ISLE_D3DRM_FROM_WINE) + target_link_libraries(tglrl PRIVATE d3drm-wine) +else() + target_link_libraries(tglrl PRIVATE d3drm) +endif() add_library(realtime STATIC LEGO1/realtime/matrix.cpp @@ -551,8 +544,10 @@ if (MSVC) endif() endif() -target_link_options(isle PRIVATE "/SAFESEH:NO") -target_link_options(lego1 PRIVATE "/SAFESEH:NO") +if(MSVC) + target_link_options(isle PRIVATE "/SAFESEH:NO") + target_link_options(lego1 PRIVATE "/SAFESEH:NO") +endif() if (MSVC_FOR_DECOMP) foreach(tgt IN LISTS lego1_targets) diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index c9507e58..d70878ed 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -334,7 +334,7 @@ int SDL_AppEvent(void* appstate, const SDL_Event* event) break; } - SDL_Keycode keyCode = event->key.keysym.sym; + SDL_Keycode keyCode = event->key.key; if (InputManager()) { InputManager()->QueueEvent(c_notificationKeyPress, keyCode, 0, 0, keyCode); } diff --git a/ISLE/isleapp.h b/ISLE/isleapp.h index 73fa918c..7acea89c 100644 --- a/ISLE/isleapp.h +++ b/ISLE/isleapp.h @@ -1,6 +1,7 @@ #ifndef ISLEAPP_H #define ISLEAPP_H +#include "legoutils.h" #include "mxtypes.h" #include "mxvideoparam.h" @@ -8,8 +9,6 @@ #include #include -enum Cursor; - // SIZE 0x8c class IsleApp { public: diff --git a/LEGO1/LegoOmni.mingw.def b/LEGO1/LegoOmni.mingw.def index e2c4ce5f..2d19d114 100644 --- a/LEGO1/LegoOmni.mingw.def +++ b/LEGO1/LegoOmni.mingw.def @@ -23,7 +23,6 @@ DllMain@12 _Z10PickEntityii _Z12EventManagerv _Z12InputManagerv -_Z12MusicManagerv _Z12SoundManagerv _Z12VideoManagerv _Z13MSoundManagerv diff --git a/LEGO1/omni/include/mxthread.h b/LEGO1/omni/include/mxthread.h index 551f900e..b5f73f56 100644 --- a/LEGO1/omni/include/mxthread.h +++ b/LEGO1/omni/include/mxthread.h @@ -33,7 +33,7 @@ class MxThread { virtual ~MxThread(); private: - static unsigned ThreadProc(void* p_thread); + static int SDLCALL ThreadProc(void* p_thread); SDL_Thread* m_thread; MxBool m_running; // 0x0c diff --git a/LEGO1/omni/src/audio/mxsoundmanager.cpp b/LEGO1/omni/src/audio/mxsoundmanager.cpp index 4c9e8e63..0a839215 100644 --- a/LEGO1/omni/src/audio/mxsoundmanager.cpp +++ b/LEGO1/omni/src/audio/mxsoundmanager.cpp @@ -73,6 +73,7 @@ MxResult MxSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread) { MxResult status = FAILURE; MxBool locked = FALSE; + ma_engine_config engineConfig; if (MxAudioManager::Create() != SUCCESS) { goto done; @@ -81,7 +82,7 @@ MxResult MxSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread) m_criticalSection.Enter(); locked = TRUE; - ma_engine_config engineConfig = ma_engine_config_init(); + engineConfig = ma_engine_config_init(); engineConfig.noDevice = MA_TRUE; engineConfig.channels = MxOmni::IsSound3D() ? 2 : 1; engineConfig.sampleRate = g_sampleRate; diff --git a/LEGO1/omni/src/system/mxthread.cpp b/LEGO1/omni/src/system/mxthread.cpp index c84cace6..79c52459 100644 --- a/LEGO1/omni/src/system/mxthread.cpp +++ b/LEGO1/omni/src/system/mxthread.cpp @@ -28,11 +28,7 @@ MxResult MxThread::Start(MxS32 p_stack, MxS32 p_flag) if (m_semaphore.Init(0, 1) == SUCCESS) { const SDL_PropertiesID props = SDL_CreateProperties(); - SDL_SetProperty( - props, - SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER, - (SDL_FunctionPointer) &MxThread::ThreadProc - ); + SDL_SetProperty(props, SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER, (void*) MxThread::ThreadProc); SDL_SetProperty(props, SDL_PROP_THREAD_CREATE_USERDATA_POINTER, this); SDL_SetNumberProperty(props, SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER, p_stack << 2); @@ -60,7 +56,7 @@ void MxThread::Terminate() } // FUNCTION: LEGO1 0x100bf680 -unsigned MxThread::ThreadProc(void* p_thread) +int MxThread::ThreadProc(void* p_thread) { return static_cast(p_thread)->Run(); } diff --git a/cmake/Findiniparser.cmake b/cmake/Findiniparser.cmake new file mode 100644 index 00000000..3b4e188c --- /dev/null +++ b/cmake/Findiniparser.cmake @@ -0,0 +1,73 @@ +if(WIN32) + set(__iniparser_shared_names "libiniparser.dll.a" "libiniparser.lib") + set(__iniparser_static_names "libiniparser.a" "iniparser.lib") +else() + if(APPLE) + set(__iniparser_shared_names "libiniparser.dylib") + else() + set(__iniparser_shared_names "libiniparser.so") + endif() + set(__iniparser_static_names "libiniparser.a") +endif() + +find_path(iniparser_INCLUDE_PATH + NAMES "iniparser.h" +) + +set(__iniparser_required_vars iniparser_INCLUDE_PATH) + +set(__iniparser_shared_required FALSE) +set(__iniparser_static_required FALSE) + +foreach(__comp ${iniparser_FIND_COMPONENTS}) + if(__comp STREQUAL "shared") + set(__iniparser_shared_required TRUE) + find_library(iniparser_shared_LIBRARY + NAMES ${__iniparser_shared_names} + ) + set(iniparser_shared_FOUND "${iniparser_shared_LIBRARY}") + if(iniparser_FIND_REQUIRED_shared) + list(APPEND __iniparser_required_vars iniparser_shared_LIBRARY) + endif() + endif() + if(__comp STREQUAL "static") + set(__iniparser_static_required TRUE) + find_library(iniparser_static_LIBRARY + NAMES ${__iniparser_static_names} + ) + set(iniparser_static_FOUND "${iniparser_static_LIBRARY}") + if(iniparser_FIND_REQUIRED_static) + list(APPEND __iniparser_required_vars iniparser_static_LIBRARY) + endif() + endif() +endforeach() + +if(NOT __iniparser_shared_required AND NOT __iniparser_static_required) + list(APPEND __iniparser_required_vars iniparser_shared_LIBRARY) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(iniparser + FOUND_VAR iniparser_FOUND + REQUIRED_VARS ${__iniparser_required_vars} + HANDLE_COMPONENTS +) + +if(iniparser_FOUND) + if(NOT TARGET iniparser-shared AND iniparser_shared_LIBRARY) + if(WIN32) + # We don't know the name and location of the dll, so use an imported target + add_library(iniparser-shared UNKNOWN IMPORTED) + set_property(TARGET iniparser-shared PROPERTY IMPORTED_IMPLIB "${iniparser_shared_LIBRARY}") + else() + add_library(iniparser-shared SHARED IMPORTED) + set_property(TARGET iniparser-shared PROPERTY IMPORTED_LOCATION "${iniparser_shared_LIBRARY}") + endif() + set_property(TARGET iniparser-shared PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${iniparser_INCLUDE_PATH}") + endif() + if(NOT TARGET iniparser-static AND iniparser_static_LIBRARY) + add_library(iniparser-static STATIC IMPORTED) + set_property(TARGET iniparser-static PROPERTY IMPORTED_LOCATION "${iniparser_static_LIBRARY}") + set_property(TARGET iniparser-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${iniparser_INCLUDE_PATH}") + endif() +endif() \ No newline at end of file