#ifndef TDx9_3DH #define TDx9_3DH // ========================================================================== // File: TDx9_3D.H // Authors: BCB_Code_Generator v2.00, // Darren Dwyer (source code, documentation, demos, website), // Hugh Edwards (documentation, icons) // Description: This file defines the TDx9_3D Component // // "TDx9_Graphics_Library v1.00" // (c) 2005 BCB-Tools.com Pty. Ltd., Sydney, Australia. // All Rights Reserved. // // Refer to the 'Licence.Txt' file for licencing & copyright information. // ========================================================================== // -------------------------------------------------------------------------- #include "TDx_Library_Defns.H" #include "TDx_Library_Functions.H" // -------------------------------------------------------------------------- #include "TDx9_Graphics_Library_Defns.H" #include "TDx9_Graphics_Library_Functions.H" // -------------------------------------------------------------------------- // external classes used by TDx9_3D methods. class TDx9_3DDevice; // -------------------------------------------------------------------------- // ========================================================================== // Class: TDx9_3D // Description: The TDx9_3D component wraps the DirectX IDirect3D9 interface // which is the initial interface created and is used to then // create the device interface and set up the environment. // // This component is used to create the TDx9_3DDevice interface, // register software devices, check device support for specific // depth stencil, format, format conversion, multisample and // device types. It also enumerates adapter modes and retrieves // adapter information such as how many adapters or modes, // current display mode, reported device capabilties, identifier // specifics and the monitor handle. // ========================================================================== #if (__BORLANDC__ >= 0x0530) // BCB Version 3 + class PACKAGE TDx9_3D : public TComponent { // -------------------------------------------------------------------------- #else // BCB Version 1 class TDx9_3D : public TComponent { #endif // ========================================================================== __published: // ========================================================================== // ---------------------------------------------------------------------- // Event: OnCreate() // Description: The OnCreate() event is triggered by the // TDx9_3D::Create() method after it has successfully // created the internal LPDIRECT3D9 used within the TDx9_3D // component. // // Note that since this event is only called upon successful // creation, this event is an ideal place for code that is // to be activated only once, immediately upon the // successful creation of the LPDIRECT3D9 interface. // // For example, you could retrieve the TDx9_3D component's // capabilities, Create() dependant components, allocate // memory, etc. // // When used in conjunction with the TDx9_3D::OnDestroy() // event, you can fully automate and insulate your code on a // per-component basis. // ---------------------------------------------------------------------- __property TDx_Event OnCreate = {read=FOnCreate, write=FOnCreate, nodefault}; // ---------------------------------------------------------------------- // Event: OnDestroy() // Description: The OnDestroy() event is triggered by the // TDx9_3D::Destroy() method, just before the TDx9_3D // internal LPDIRECT3D9 interface is destroyed. // // Note: This event is an ideal place to place code that // reverses the results of the TDx9_3D::OnCreate() event. // For example, assume you have already setup the // TDx9_3D::OnCreate() event to retrieve the component's // capabilities, Create() a dependant component and allocate // some memory; // You can then fully automate and insulate your code on a // per-component basis by placing code in the // TDx9_3D::OnDestroy() event to deallocate memory, // Destroy() the dependant components and, when required, // destroy the capabilities component. // ---------------------------------------------------------------------- __property TDx_Event OnDestroy = {read=FOnDestroy, write=FOnDestroy, nodefault}; // ---------------------------------------------------------------------- // Event: OnError() // Description: The OnError event is called when an error occurs in the // TDx9_3D component. // ---------------------------------------------------------------------- __property TDx_Error OnError = {read=FOnError, write=FOnError, nodefault}; // ========================================================================== public: // ========================================================================== // ---------------------------------------------------------------------- // Property: Created // Description: The Created property is true if the internal LPDIRECT3D9 // used in this component has been successfully created, // otherwise Created is false. // // To create the internal LPDIRECT3D9, call the // TDx9_3D::Create() method. // ---------------------------------------------------------------------- __property bool Created = { read=FGetCreated, write=FSetCreated, default=false }; // ---------------------------------------------------------------------- // Property: ErrorValue // Description: The ErrorValue property contains the last error value // returned from a call to a TDx9_3D method or fget/fset. // eg. D3D_OK or DDERR_SURFACELOST or TDX_ERROR // ---------------------------------------------------------------------- __property HRESULT ErrorValue = { read=FGetErrorValue, write=FSetErrorValue, default=D3D_OK }; // ---------------------------------------------------------------------- // Method: CheckDepthStencilMatch() // Description: The TDx9_3D::CheckDepthStencilMatch() method will check // that a specific depth stencil format is compatible with a // render target format in a particular display mode. // // This method is included in DirectX9 to enable // applications to work with hardware that requires certain // depth formats only work with certain render target // formats. // Unlike DirectX 8.1, D24x8 and D32 depth-stencil formats // are not assumed to work with 32- or 16-bit render // targets, it will now return successfully for these // formats only if the device is capable of mixed-depth // operations. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when a parameter is invalid. // D3DERR_NOTAVAILABLE when the check indicates incompatible // formats. // Params: pAdapter - // The Adapter parameter specifies the ordinal of the // display adapter to query. // D3DADAPTER_DEFAULT always indicates the primary display // adapter. // pDeviceType - // The DeviceType parameter specifies the device type, as a // value of the D3DDEVTYPE enumerated type. // pAdapterFormat - // The AdapterFormat parameter specifies which display mode // format the adapter will be set to, as a value of the // D3DFORMAT enumerated type. // pRenderTargetFormat - // The RenderTargetFormat parameter specifies which render // target format is to be tested, as a value of the // D3DFORMAT enumerated type. // pDepthStencilFormat - // The DepthStencilFormat parameter specifies which depth // stencil format is to be tested, as a value of the // D3DFORMAT enumerated type. // ---------------------------------------------------------------------- virtual bool __fastcall CheckDepthStencilMatch( uint pAdapter, D3DDEVTYPE pDeviceType, D3DFORMAT pAdapterFormat, D3DFORMAT pRenderTargetFormat, D3DFORMAT pDepthStencilFormat ); // ---------------------------------------------------------------------- // Method: CheckDeviceFormat() // Description: The TDx9_3D::CheckDeviceFormat() method will check that a // specific surface format is available as a specified // resource type and can be used as a texture, depth stencil // buffer, render target or any combination of the three, on // a device representing this adapter. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when Adapter >= the number of display // adapters in the system or is an unsupported DeviceType. // D3DERR_NOTAVAILABLE when the specified device and usage // will not accept the format. // Params: pAdapter - // The Adapter parameter specifies the ordinal of the // display adapter to query. // D3DADAPTER_DEFAULT always indicates the primary display // adapter. // pDeviceType - // The DeviceType parameter specifies the device type, as a // value of the D3DDEVTYPE enumerated type. // pAdapterFormat - // The AdapterFormat parameter specifies which display mode // format the adapter will be set to, as a value of the // D3DFORMAT enumerated type. // pUsage - // The Usage parameter defines the usage options for the // surface as any combination of the D3DUSAGE and // D3DUSAGE_QUERY constants. // Some D3DUSAGE's are invalid for this method. // pRType - // The RType parameter specifies which resource type is // requested for use with the queried format, as a value of // the D3DRESOURCETYPE enumerated type. // pCheckFormat - // The CheckFormat parameter specifies the format of the // surfaces whose use is defined by Usage, as a value of the // D3DFORMAT enumerated type. // ---------------------------------------------------------------------- virtual bool __fastcall CheckDeviceFormat( uint pAdapter, D3DDEVTYPE pDeviceType, D3DFORMAT pAdapterFormat, dword pUsage, D3DRESOURCETYPE pRType, D3DFORMAT pCheckFormat ); // ---------------------------------------------------------------------- // Method: CheckDeviceFormatConversion() // Description: The TDx9_3D::CheckDeviceFormatConversion() method will // check whether the device can convert from one display // format to another. // // When you use TDx9_3D::CheckDeviceType() to test // compatibility between a back buffer and a display of a // different format, it will return values that reflect the // device capabilities. This means when the device cannot // render to the requested back buffer format, the call will // return D3DERR_NOTAVAILABLE even if color conversion is // availble. If the device can render, but not color // convert, the return value will also be // D3DERR_NOTAVAILABLE. // This method helps an application discover what hardware // support is available for the presentation itself, as // distinct from rendering capabilities. // No software emulation for the color-converting // presentation itself will be offered. // This method also helps determine the source and // destination surface formats are permissible in // TDx9_3DDevice::StretchRect(). // // Color conversion is restricted to the following source // and target formats. // The source must be a four-character code (FOURCC) format // or valid back buffer format. // The target format must be one of these unsigned formats: // D3DFMT_X1R5G5B5, D3DFMT_A1R5G5B5, D3DFMT_R5G6B5, // D3DFMT_R8G8B8, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8, // D3DFMT_A2R10G10B10, D3DFMT_A16B16G16R16, // D3DFMT_A2B10G10R10, D3DFMT_A8B8G8R8, D3DFMT_X8B8G8R8, // D3DFMT_A16B16G16R16F or D3DFMT_A32B32G32R32F. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when the method simply fails. // D3DERR_NOTAVAILABLE when the specified conversion is not // supported. // Params: pAdapter - // The Adapter parameter specifies the ordinal of the // display adapter to query. // D3DADAPTER_DEFAULT always indicates the primary display // adapter. // pDeviceType - // The DeviceType parameter specifies the device type, as a // value of the D3DDEVTYPE enumerated type. // pSourceFormat - // The SourceFormat parameter specifies the source format, // as a value of the D3DFORMAT enumerated type. // pTargetFormat - // The TargetFormat parameter specifies the destination // format, as a value of the D3DFORMAT enumerated type. // ---------------------------------------------------------------------- virtual bool __fastcall CheckDeviceFormatConversion( uint pAdapter, D3DDEVTYPE pDeviceType, D3DFORMAT pSourceFormat, D3DFORMAT pTargetFormat ); // ---------------------------------------------------------------------- // Method: CheckDeviceMultiSampleType() // Description: The TDx9_3D::CheckDeviceMultiSampleType() method will // check whether the device supports a specified // multisampling technique. // // Check both render target and depth stencil surfaces using // this method when using multisampling because both must be // multisampled if you want to use them together. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when Adapter or MultiSampleType is // invalid. // D3DERR_NOTAVAILABLE when the specified multisampling // technique is not supported. // D3DERR_INVALIDDEVICE when the DeviceType does not apply // to this adapter. // Params: pAdapter - // The Adapter parameter specifies the ordinal of the // display adapter to query. // D3DADAPTER_DEFAULT always indicates the primary display // adapter. // pDeviceType - // The DeviceType parameter specifies the device type, as a // value of the D3DDEVTYPE enumerated type. // pSurfaceFormat - // The SurfaceFormat parameter specifies the surface format // you want to multisample, as a value of the D3DFORMAT // enumerated type. // pWindowed - // The Windowed parameter indicates whether windowed // multisampling is being checked. // Set TRUE to check windowed multisampling and FALSE to // check full screen multisampling. // pMultiSampleType - // The MultiSampleType parameter specifies which multisample // type to check, as a value of the D3DMULTISAMPLE_TYPE // enumerated type. // pQualityLevels - // The QualityLevels parameter will indicate how many // quality stops are available for the specified multisample // type. // Can be NULL if this return value is not required. // ---------------------------------------------------------------------- virtual HRESULT __fastcall CheckDeviceMultiSampleType( uint pAdapter, D3DDEVTYPE pDeviceType, D3DFORMAT pSurfaceFormat, bool pWindowed, D3DMULTISAMPLE_TYPE pMultiSampleType, dword* pQualityLevels ); // ---------------------------------------------------------------------- // Method: CheckDeviceType() // Description: The TDx9_3D::CheckDeviceType() method will check whether // the adapter supports a specific hardware accelerated // device type. // // This method checks if the hardware and drivers necessary // for a specified Hardware Abstraction Layer (HAL) device // type are available. // Specifying a DisplayFormat with an alpha channel for a // full screen application will fail this method. Back // buffer alpha channels are allowed, but the two display // formats must be otherwise identical. // For example: A DisplayFormat of D3DFMT_X1R5G5B5 works // with a BackBufferFormat of D3DFMT_X1R5G5B5 or // D3DFMT_A1R5G5B5 but not D3DFMT_R5G6B5. // // When you use TDx9_3D::CheckDeviceType() to test // compatibility between a back buffer and a display of a // different format, it will return values that reflect the // device capabilities. This means when the device cannot // render to the requested back buffer format, the call will // return D3DERR_NOTAVAILABLE even if color conversion is // availble. If the device can render, but not color // convert, the return value will also be // D3DERR_NOTAVAILABLE. // The TDx9_3D::CheckDeviceFormatConversion() method helps // an application discover what hardware support is // available for the presentation itself, as distinct from // rendering capabilities. // No software emulation for the color-converting // presentation itself will be offered. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when Adapter >= the number of display // adapters in the system or is an unsupported DeviceType. // D3DERR_NOTAVAILABLE when the specified back buffer format // is not supported or there is no hardware acceleration for // the specified formats. // Params: pAdapter - // The Adapter parameter specifies the ordinal of the // display adapter to enumerate. // D3DADAPTER_DEFAULT always indicates the primary display // adapter. // pDeviceType - // The DeviceType parameter specifies the device type to // check, as a value of the D3DDEVTYPE enumerated type. // pDisplayFormat - // The DisplayFormat parameter specifies which display mode // to check the device under, as a value of the D3DFORMAT // enumerated type. // pBackBufferFormat - // The BackBufferFormat parameter specifies which back // buffer format to check the device under, as a value of // the D3DFORMAT enumerated type. // // This must be a render target format, // TDx9_3DDevice::GetDisplayMode() can be used to retrieve // the current format. // Windowed applications can have a back buffer format that // is different to the display format, but only if there is // hardware support for color conversion. Possible back // buffer formats are limited in these circumstances, but // any valid backbuffer format will be presented to any // desktop format. However, the device must also be operable // in desktop mode, as many devices do not operate in 8 bits // per pixel modes. // Full-screen applications cannot do color conversion. // The D3DFMT_UNKNOWN value is allowed for windowed mode. // pWindowed - // The Windowed parameter indicates whether the device type // will be checked for windowed operation. // Set TRUE to check windowed operation and FALSE to check // full screen operation. // ---------------------------------------------------------------------- virtual bool __fastcall CheckDeviceType( uint pAdapter, D3DDEVTYPE pDeviceType, D3DFORMAT pDisplayFormat, D3DFORMAT pBackBufferFormat, bool pWindowed ); // ---------------------------------------------------------------------- // Method: Create() // Description: The Create() method is used to automatically create the // internal LPDIRECT3D9 interface used in the TDx9_3D // component and must be called before any methods of the // TDx9_3D component will function. // ---------------------------------------------------------------------- virtual bool __fastcall Create(); // ---------------------------------------------------------------------- // Method: CreateDevice() // Description: The TDx9_3D::CreateDevice() method is used to create a // device to represent the display adapter. // // A fully working device interface is returned, already set // to the required display or windowed mode and with the // requested back buffers. // To begin rendering, just create and set a depth buffer if // EnableAutoDepthStencil is set to FALSE in // PresentationParameters. // // When creating the TDx9_3DDevice, two window handles are // needed, the FocusWindow parameter and DeviceWindow // property of PresentationParameters: // The focus window indicates to Direct3D when switching // from foreground mode to background mode due to events // like Alt-Tab or minimise. There is only one focus window // that is shared by each device created by an application. // The device window determines the location and size of the // back buffer on screen and is used during // TDx9_3DDevice::Present() when the back buffer contents // are copied to the front buffer. // // Window handles should never be passed to Direct3D while // handling WM_CREATE and this method is no exception. Calls // to create, release or reset the device must be done by // the same thread as the window procedure of the focus // window. // // One of the mutually exclusive processing flags, // D3DCREATE_HARDWARE_VERTEXPROCESSING, // D3DCREATE_MIXED_VERTEXPROCESSING and // D3DCREATE_SOFTWARE_VERTEXPROCESSING, must be set. // // D3DPRESENTFLAG_LOCKABLE_BACKBUFFER must be set in the // PresentationParameters for the back buffer to be // lockable, but multisampled back buffers and depth // surfaces are never lockable. // // The TDx9_3DDevice::Reset(), IUnknown::Release() and // TDx9_3DDevice::TestCooperativeLevel() methods must be // called from the same thread as created the device. // // When using windowed mode, D3DFMT_UNKNOWN can be specified // as the back buffer format in TDx9_3D::CreateDevice(), // TDx9_3DDevice::Reset() and // TDx9_3DDevice::CreateAdditionalSwapChain(). As a result, // you don't need to retrieve the desktop format before the // create call. // In full screen mode, the back buffer format must always // be specified. // Attempts to create a device on a 0x0 sized window will // fail. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_DEVICELOST when the device is lost but cannot be // reset at the moment. Rendering is not possible. // D3DERR_INVALIDCALL for invalid parameters or settings. // D3DERR_NOTAVAILABLE when the device doesn't support the // specified settings. // D3DERR_OUTOFVIDEOMEMORY if there is insufficient display // memory for the device to be created. // Params: pAdapter - // The Adapter parameter specifies the ordinal of the // display adapter. // D3DADAPTER_DEFAULT always indicates the primary display // adapter. // pDeviceType - // The DeviceType parameter specifies the device type to // create, as a value of the D3DDEVTYPE enumerated type. // If the type is unsupported, the method will fail. // pFocusWindow - // The FocusWindow parameter specifies the focus window that // alerts Direct3D when the application switches from // foreground mode to background mode. // This must be a top level window for full screen mode. // NULL may be specified for windowed mode, but then you // must provide a non-NULL handle in either // TDx9_3DDevice::Present->DestWndOverride or // TD3DPresent_Parameters->DeviceWindow when calling // TDx9_3DDevice::Present(). // pBehaviorFlags - // The BehaviorFlags parameter contains device creation // settings as defined by the D3DCREATE constant. // pPresentationParameters - // The PresentationParameters parameter references a // TD3DPresent_Parameters component containing the // presentation settings for the device to be created. // // After the create call, the returned // TD3DPresent_Parameters may have several different values, // specifically: // If BackBufferCount, BackBufferWidth and BackBufferHeight // were 0, they will be set to the appropriate values when // the method returns. // If BackBufferFormat was D3DFMT_UNKNOWN, then it will be // set to the appropriate format when the method returns. // // If D3DCREATE_ADAPTERGROUP_DEVICE is specified in // BehaviorFlags, then TD3DPresent_Parameters can contain // multiple instances of presentation parameters. // No matter how many heads exist, only one depth/stencil // surface is created automatically. // // For Win2K and XP, the full-screen device display refresh // rate will be set to the closest supported rate below it, // in this order: // User specified nonzero ForcedRefreshRate registry key, if // supported. // Application specified nonzero refresh rate value in the // presentation parameter. // Refresh rate of the latest desktop mode, if supported. // 75 hertz if supported. // 60 hertz if supported. // Device default. // pReturnedDeviceInterface - // The ReturnedDeviceInterface parameter will reference the // address of the created TDx9_3DDevice. // ---------------------------------------------------------------------- virtual bool __fastcall CreateDevice( uint pAdapter, D3DDEVTYPE pDeviceType, HWND pFocusWindow, dword pBehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, TDx9_3DDevice* pReturnedDeviceInterface ); // ---------------------------------------------------------------------- // Method: Destroy() // Description: The Destroy() method is used to automatically destroy the // internal LPDIRECT3D9 interface used in the TDx9_3D // component and should be called when the internal // interface is no longer required. // // Note: This method is called by the component's // destructor. // ---------------------------------------------------------------------- virtual bool __fastcall Destroy(); // ---------------------------------------------------------------------- // Method: EnumAdapterModes() // Description: The TDx9_3D::EnumAdapterModes() method checks that an // adapter supports the requested display mode and format. // // By utilizing this method in a loop, all available adapter // modes can be enumerated. // Enumeration is restricted to display modes exactly // matching the provided format, ignoring alpha. // // Pixel formats 565 and 555 are treated as equivalent and // the correct version will be returned. // The difference only affects anything when locking the // back buffer, which requires an explicit flag to be set by // the application. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when Adapter >= available display // adapters. // D3DERR_NOTAVAILABLE when there is no support for the // surface format or acceleration is not available. // Params: pAdapter - // The Adapter parameter specifies the ordinal of the // display adapter. // D3DADAPTER_DEFAULT always indicates the primary display // adapter. // pFormat - // The Format parameter specifies the surface format you // want to enumerate, as a value of the D3DFORMAT enumerated // type. // // Allowed values are D3DFMT_A1R5G5B5, D3DFMT_A2R10G10B10, // D3DFMT_A8R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5 and // D3DFMT_X8R8G8B8. // pMode - // The Mode parameter specifies the display mode index. // // This value must be an unsigned integer between 0 and one // less than the return value of // TDx9_3D::GetAdapterModeCount(). // pDisplayMode - // The DisplayMode parameter will reference a // TD3DDisplayMode component describing the available // display mode. // ---------------------------------------------------------------------- virtual bool __fastcall EnumAdapterModes( uint pAdapter, D3DFORMAT pFormat, uint pMode, D3DDISPLAYMODE* pDisplayMode ); // ---------------------------------------------------------------------- // Method: GetAdapterCount() // Description: The TDx9_3D::GetAdapterCount() method will return an // unsigned integer specifying how many adapters were // available when this TDx9_3D component was created. // ---------------------------------------------------------------------- virtual UINT __fastcall GetAdapterCount(); // ---------------------------------------------------------------------- // Method: GetAdapterDisplayMode() // Description: The TDx9_3D::GetAdapterDisplayMode() method retrieves the // current display mode. // // Extended formats will not be returned accurately, // reporting X8R8G8B8 instead. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when Adapter >= available display // adapters or Mode is invaild. // Params: pAdapter - // The Adapter parameter specifies the ordinal of the // display adapter to query. // D3DADAPTER_DEFAULT always indicates the primary display // adapter. // pMode - // The Mode parameter references a TD3DDisplayMode component // for holding the returned display mode. // ---------------------------------------------------------------------- virtual bool __fastcall GetAdapterDisplayMode( uint pAdapter, D3DDISPLAYMODE* pMode ); // ---------------------------------------------------------------------- // Method: GetAdapterIdentifier() // Description: The TDx9_3D::GetAdapterIdentifier() method will retrieve // information about the specified display adapter. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when Adapter >= available display // adapters, Flags has unrecognized flags or Identifier is // NULL or unwritable. // Params: pAdapter - // The Adapter parameter specifies the ordinal of the // display adapter. // D3DADAPTER_DEFAULT always indicates the primary display // adapter. // pFlags - // The Flags parameter specifies the value of // TD3DAdapter_Identifier->WHQLLevel. // // This value can be 0 or D3DENUM_WHQL_LEVEL. // When D3DENUM_WHQL_LEVEL is set, this call can connect to // the internet and retrieve new Windows Hardware Quality // Labs (WHQL) certificates. // Flags: // D3DENUM_WHQL_LEVEL - // The D3DENUM_WHQL_LEVEL Flag is possibly unused. // pIdentifier - // The Identifier parameter references a // TD3DAdapter_Identifier component for holding the returned // information. // // If Adapter is out of range, TD3DAdapter_Identifier will // be zero'd. // ---------------------------------------------------------------------- virtual bool __fastcall GetAdapterIdentifier( uint pAdapter, dword pFlags, D3DADAPTER_IDENTIFIER9* pIdentifier ); // ---------------------------------------------------------------------- // Method: GetAdapterModeCount() // Description: The TDx9_3D::GetAdapterModeCount() method will retrieve // how many display modes are available on the specified // adapter for a given format. // // This method will return 0 if Adapter >= available display // adapters. // Params: pAdapter - // The Adapter parameter specifies the ordinal of the // display adapter. // D3DADAPTER_DEFAULT always indicates the primary display // adapter. // pFormat - // The Format parameter specifies the surface format you // want to use, as a value of the D3DFORMAT enumerated type. // // TDx9_3D::EnumAdapterModes() can be used to retrieve valid // formats for the adapter. // ---------------------------------------------------------------------- virtual UINT __fastcall GetAdapterModeCount( uint pAdapter, D3DFORMAT pFormat ); // ---------------------------------------------------------------------- // Method: GetAdapterMonitor() // Description: The TDx9_3D::GetAdapterMonitor() method will return this // components associated monitor handle. // Params: pAdapter - // The Adapter parameter specifies the ordinal of the // display adapter. // D3DADAPTER_DEFAULT always indicates the primary display // adapter. // ---------------------------------------------------------------------- virtual HMONITOR __fastcall GetAdapterMonitor( uint pAdapter ); // ---------------------------------------------------------------------- // Method: GetDeviceCaps() // Description: The TDx9_3D::GetDeviceCaps() method will retrieve the // capabilities of an adapter for a specified device type. // // Do not assume vertex processing capabilities across // Direct3D devices as the exposed capabilities depend on // the parameter settings of the TDx9_3D::CreateDevice() // call. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when there are invalid parameters. // D3DERR_INVALIDDEVICE for an invalid device type. // D3DERR_OUTOFVIDEOMEMORY if there is not enough display // memory for the operation. // Params: pAdapter - // The Adapter parameter specifies the ordinal of the // display adapter. // D3DADAPTER_DEFAULT always indicates the primary display // adapter. // pDeviceType - // The DeviceType parameter specifies the device type as a // value of the D3DDEVTYPE enumerated type. // pCaps - // The Caps parameter references a TD3DCaps component that // will be filled with the capability information for the // specified adapter and device type. // ---------------------------------------------------------------------- virtual bool __fastcall GetDeviceCaps( uint pAdapter, D3DDEVTYPE pDeviceType, D3DCAPS9* pCaps ); // ---------------------------------------------------------------------- // Method: RegisterSoftwareDevice() // Description: The TDx9_3D::RegisterSoftwareDevice() method will // register a pluggable software device, which can enable // the application to access a variety of software // rasterisers and other emulated devices. // // When there is no 3D acceleration hardware, software // emulation may be needed. Software rasterization devices // emulate color 3D hardware. // Emulation is slower than specialized hardware but can // take advantage of CPU instructions like the AMD 3DNow! or // Intel MMX instruction sets. // Direct3D used 3D-Now! for some lighting operations and // MMX for rasterization acceleration. // // Software devices communicate with Direct3D through an // interface similar to the hardware device driver interface // (DDI). // The Direct3D Driver Development Kit (DDK) provides the // documentation and headers for developing pluggable // software devices. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when there are invalid parameters. // D3DERR_OUTOFVIDEOMEMORY if there is not enough display // memory for the operation. // Params: pInitializeFunction - // The InitializeFunction parameter references the software // device's initialization function. // ---------------------------------------------------------------------- virtual bool __fastcall RegisterSoftwareDevice( void* pInitializeFunction ); // ---------------------------------------------------------------------- // Constructor() and Destructor() // ---------------------------------------------------------------------- __fastcall TDx9_3D(TComponent* Owner); virtual __fastcall ~TDx9_3D(); // ---------------------------------------------------------------------- // The following properties and methods are used internally by // TDx9_Graphics_Library and should not be used. // ---------------------------------------------------------------------- __property LPDIRECT3D9 Internal_LPDIRECT3D9 = { read=FGetInternal_LPDIRECT3D9, write=FSetInternal_LPDIRECT3D9, nodefault }; __property LPDIRECT3D9* Internal_LPDIRECT3D9_Ptr = { read=FGetInternal_LPDIRECT3D9_Ptr, nodefault }; void __fastcall Internal_LPDIRECT3D9_Update(); // ========================================================================== protected: // ========================================================================== // ---------------------------------------------------------------------- // Property Access Methods // ---------------------------------------------------------------------- bool __fastcall FGetCreated(); void __fastcall FSetCreated( bool pCreated ); HRESULT __fastcall FGetErrorValue(); void __fastcall FSetErrorValue( HRESULT pErrorValue ); // ========================================================================== private: // ========================================================================== // ---------------------------------------------------------------------- // Internal Interface Access // ---------------------------------------------------------------------- LPDIRECT3D9 __fastcall FGetInternal_LPDIRECT3D9(); void __fastcall FSetInternal_LPDIRECT3D9( LPDIRECT3D9 pLPDIRECT3D9 ); LPDIRECT3D9* __fastcall FGetInternal_LPDIRECT3D9_Ptr(); // ---------------------------------------------------------------------- // Property Variables // ---------------------------------------------------------------------- bool fCreated; HRESULT fErrorValue; // ---------------------------------------------------------------------- // Interface Variables // ---------------------------------------------------------------------- LPDIRECT3D9 fLPDIRECT3D9; // ---------------------------------------------------------------------- // Event Variables // ---------------------------------------------------------------------- TDx_Event FOnCreate; TDx_Event FOnDestroy; TDx_Error FOnError; }; // -------------------------------------------------------------------------- #endif // --------------------------------------------------------------------------