//  // // # # ### # # -= Nuclex Library =-  // // ## # # # ## ## Direct3D9VideoRenderer.h - Rendering context  // // ### # # ###  // // # ### # ###  // // # ## # # ## ##  // // # # ### # # R4 (C)2003 Markus Ewald -> License.txt  // //  // #ifndef NUCLEX_VIDEO_DIRECT3D9VIDEORENDERER_H #define NUCLEX_VIDEO_DIRECT3D9VIDEORENDERER_H #include "Direct3D9Plugin/Direct3D9Plugin.h" #include "Direct3D9Plugin/Video/Direct3D9RenderStates.h" #include "Nuclex/Video/VideoDevice.h" #include "Nuclex/Video/Video.h" namespace Nuclex { namespace Video { class Direct3D9VideoDevice; class Direct3D9Texture; class Direct3D9VertexBuffer; class Direct3D9IndexBuffer; class Direct3D9VertexShader; class Direct3D9RenderStates; //  // //  Nuclex::Video::Direct3D9RenderingContext  // //  // /// NuclexGame renderer base class /** */ class Direct3D9RenderingContext : public VideoDevice::RenderingContext { public: /// Constructor DIRECT3D9PLUGIN_API Direct3D9RenderingContext(Direct3D9VideoDevice *pVideoDevice); /// Destructor DIRECT3D9PLUGIN_API virtual ~Direct3D9RenderingContext(); // // VideoRenderer implementation // public: /// Get current screen size DIRECT3D9PLUGIN_API const Point2 &getScreenSize() const; /// Access render states DIRECT3D9PLUGIN_API RenderStates &getRenderStates() { return *m_pActiveRenderStates; } /// Get view matrix DIRECT3D9PLUGIN_API const Matrix44 &getViewMatrix(void) const; /// Set view matrix DIRECT3D9PLUGIN_API void setViewMatrix(const Matrix44 &View); /// Get projection matrix DIRECT3D9PLUGIN_API const Matrix44 &getProjectionMatrix(void) const; /// Set projection matrix DIRECT3D9PLUGIN_API void setProjectionMatrix(const Matrix44 &Projection); /// Get world matrix DIRECT3D9PLUGIN_API const Matrix44 &getWorldMatrix() const; /// Set world matrix DIRECT3D9PLUGIN_API void setWorldMatrix(const Matrix44 &world); /// Get render states DIRECT3D9PLUGIN_API const Direct3D9RenderStates &getRenderStates() const; /// Get current texture DIRECT3D9PLUGIN_API const shared_ptr &getTexture(size_t nStage) const; /// Select texture DIRECT3D9PLUGIN_API void setTexture(size_t nStage, const shared_ptr &spTexture); /// Retrieve current vertex buffer DIRECT3D9PLUGIN_API const shared_ptr &getVertexBuffer(size_t nStream) const; /// Set vertex buffer DIRECT3D9PLUGIN_API void setVertexBuffer(size_t nStream, const shared_ptr &spVertexBuffer); /// Retrieve current index buffer DIRECT3D9PLUGIN_API const shared_ptr &getIndexBuffer() const; /// Set index buffer DIRECT3D9PLUGIN_API void setIndexBuffer(const shared_ptr &spIndexBuffer); /// Retrieve current vertex shader DIRECT3D9PLUGIN_API const shared_ptr &getVertexShader() const; /// Set vertex shader DIRECT3D9PLUGIN_API void setVertexShader(const shared_ptr &VertexShader); /// Render primitive DIRECT3D9PLUGIN_API void drawPrimitive(PrimitiveType eType, size_t nStartVertex, size_t nNumPrimitives); /// Draw primitives from indexed vertex buffer DIRECT3D9PLUGIN_API void drawIndexedPrimitive(PrimitiveType eType, size_t nVertexCount, size_t nFaceCount); /// Set scissor region for rendering DIRECT3D9PLUGIN_API void setScissorRegion(const Box2 &ScissorRegion); /* /// Draw a screen-aligned line DIRECT3D9PLUGIN_API void drawLine(const Vector2 &Start, const Vector2 &End, const Color &DrawingColor = Color(1, 1, 1, 1)) {} /// Draws a screen-aligned box DIRECT3D9PLUGIN_API void drawBox(const Vector2 &Start, const Vector2 &End, const Color &DrawingColor = Color(1, 1, 1, 1)) {} /// Draws a screen-aligned filled box DIRECT3D9PLUGIN_API void drawFilledBox(const Vector2 &Start, const Vector2 &End, const Color &DrawingColor = Color(1, 1, 1, 1), const shared_ptr &spTexture = shared_ptr(), const Box2 &spTextureRegion = Box2()) {} /// Draws screen-aligned text DIRECT3D9PLUGIN_API void drawText(const string &sText, const Vector2 &Position, const Color &TextColor = Color(1, 1, 1, 1), Font::Alignment eAlignment = Font::Alignment::A_NORMAL) {} */ private: Direct3D9VideoDevice *m_pVideoDevice; ///< Video renderer IDirect3DDevice9 *m_pDirect3DDevice; ///< Direct3D device Matrix44 m_View; ///< View matrix Matrix44 m_Projection; ///< Projection matrix Matrix44 m_World; ///< World matrix Point2 m_Size; ///< Rendering surface size shared_ptr m_pspTexture[MaxTextureStages]; ///< Current texture Direct3D9Texture *m_ppTexture[MaxTextureStages]; ///< Current D3D9 texture shared_ptr m_pspVertexBuffer[MaxVertexStreams]; ///< Current vertex buffer Direct3D9VertexBuffer *m_ppVertexBuffer[MaxVertexStreams]; ///< Current D3D9 vertex buffer shared_ptr m_spIndexBuffer; ///< Current index buffer Direct3D9IndexBuffer *m_pIndexBuffer; ///< Current D3D9 index buffer shared_ptr m_spVertexShader; ///< Current vertex shader Direct3D9VertexShader *m_pVertexShader; ///< Current D3D9 vertex shader RenderStates *m_pActiveRenderStates; /* unsigned long m_nDrawPrimitiveCount; ///< Number of DrawPrimitive() calls unsigned long m_nSetTextureCount; unsigned long m_nSetVertexBufferCount; unsigned long m_nSetIndexBufferCount; */ }; }} // namespace Nuclex::Video #endif // NUCLEX_VIDEO_DIRECT3D9VIDEORENDERER_H