1 // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 // This file is part of the "Irrlicht Engine". 3 // For conditions of distribution and use, see copyright notice in irrlicht.h 4 5 #ifndef __C_D3D9_PARALLAX_MAPMATERIAL_RENDERER_H_INCLUDED__ 6 #define __C_D3D9_PARALLAX_MAPMATERIAL_RENDERER_H_INCLUDED__ 7 8 #include "IrrCompileConfig.h" 9 #ifdef _IRR_WINDOWS_ 10 11 #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_ 12 #if defined(__BORLANDC__) || defined (__BCPLUSPLUS__) 13 #include "irrMath.h" // needed by borland for sqrtf define 14 #endif 15 #include <d3d9.h> 16 17 #include "CD3D9ShaderMaterialRenderer.h" 18 #include "IShaderConstantSetCallBack.h" 19 20 namespace irr 21 { 22 namespace video 23 { 24 25 //! Renderer for normal maps using parallax mapping 26 class CD3D9ParallaxMapRenderer : 27 public CD3D9ShaderMaterialRenderer, IShaderConstantSetCallBack 28 { 29 public: 30 31 CD3D9ParallaxMapRenderer( 32 IDirect3DDevice9* d3ddev, video::IVideoDriver* driver, 33 s32& outMaterialTypeNr, IMaterialRenderer* baseMaterial); 34 35 ~CD3D9ParallaxMapRenderer(); 36 37 //! Called by the engine when the vertex and/or pixel shader constants for an 38 //! material renderer should be set. 39 virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData); 40 41 virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype); 42 43 //! Returns the render capability of the material. 44 virtual s32 getRenderCapability() const; 45 OnSetMaterial(const SMaterial & material)46 virtual void OnSetMaterial(const SMaterial& material) { } 47 virtual void OnSetMaterial(const video::SMaterial& material, 48 const video::SMaterial& lastMaterial, 49 bool resetAllRenderstates, video::IMaterialRendererServices* services); 50 51 private: 52 53 f32 CurrentScale; 54 55 }; 56 57 } // end namespace video 58 } // end namespace irr 59 60 #endif 61 #endif 62 #endif 63 64