#ifndef D3DResourceManager_h_ #define D3DResourceManager_h_ #include #include #include #include // For monitoring geometry list nodes #include #include // Resources #include #include //#define D3D9_SUPPORTED #if defined(D3D9_SUPPORTED) #define WIN32_LEAN_AND_MEAN #include #include // Light Item struct LightItem { D3DLIGHT9 m_lightDesc; MCallbackId m_objectDeleteMonitor; MCallbackId m_objectDirtyMonitor; bool m_enabled; }; typedef std::list LightItemList; struct CameraItem { // View matrix parameters D3DXVECTOR3 m_vEyePt; // Eye position D3DXVECTOR3 m_vLookatPt; // Look at position D3DXVECTOR3 m_vUpVec; // Up vector // Projection matrix parameters float m_FieldOfView; // Field of view (in degrees) float m_nearClip; // Near clip plane float m_farClip; // Far clip plane }; // Post-processing effect item struct PostEffectItem { LPD3DXEFFECT fEffect; MString fName; }; typedef std::list PostEffectItemList; class MDagPath; class MObject; class MRenderingInfo; // // Manager for D3D resources // class D3DResourceManager { public: D3DResourceManager(); virtual ~D3DResourceManager(); D3DGeometry* getGeometry( const MDagPath& dagPath, LPDIRECT3DDEVICE9 D3D); D3DTexture* getTexture( MObject& mayaTexture); void clearResources(bool onlyInvalidItems, bool clearShaders); bool cleanupLighting(LPDIRECT3DDEVICE9 D3D); bool setupLighting(LPDIRECT3DDEVICE9 D3D); void enableLights( bool val, LPDIRECT3DDEVICE9 D3D ); bool translateCamera( const MDagPath &cameraPath); CameraItem* getCamera() { return &m_camera; } bool initializePostEffects( const MString &effectsLocation, LPDIRECT3DDEVICE9 D3D); const MStringArray & getListOfEnabledPostEffects(); const PostEffectItemList & getPostEffectItemList() const { return m_PostEffectItemList; } protected: void initializeDefaultCamera(); //LPDIRECT3DDEVICE9 D3D // List of D3D lights corresponding to Maya lights. // LightItemList m_lightItemList; unsigned int m_numberLightsEnabled; // List of D3D geometry corresponding to Maya dag paths // GeometryItemList m_geometryItemList; // List of D3D textures corresponding to Maya texture nodes // TextureItemList m_textureItemList; // List od D3d 2D post processing effects PostEffectItemList m_PostEffectItemList; // - List items (by name) in previous list which are enabled. MStringArray m_EnabledPostEffectItemList; CameraItem m_camera; }; #endif #endif /* D3DResourceManager_h_ */ //- // ========================================================================== // Copyright (C) 1995 - 2006 Autodesk, Inc. and/or its licensors. All // rights reserved. // // The coded instructions, statements, computer programs, and/or related // material (collectively the "Data") in these files contain unpublished // information proprietary to Autodesk, Inc. ("Autodesk") and/or its // licensors, which is protected by U.S. and Canadian federal copyright // law and by international treaties. // // The Data is provided for use exclusively by You. You have the right // to use, modify, and incorporate this Data into other products for // purposes authorized by the Autodesk software license agreement, // without fee. // // The copyright notices in the Software and this entire statement, // including the above license grant, this restriction and the // following disclaimer, must be included in all copies of the // Software, in whole or in part, and all derivative works of // the Software, unless such copies or derivative works are solely // in the form of machine-executable object code generated by a // source language processor. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. // AUTODESK DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED // WARRANTIES INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF // NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR // PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE, OR // TRADE PRACTICE. IN NO EVENT WILL AUTODESK AND/OR ITS LICENSORS // BE LIABLE FOR ANY LOST REVENUES, DATA, OR PROFITS, OR SPECIAL, // DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK // AND/OR ITS LICENSORS HAS BEEN ADVISED OF THE POSSIBILITY // OR PROBABILITY OF SUCH DAMAGES. // // ========================================================================== //+