/Irrlicht/CTRTextureGouraud.h
C++ Header | 85 lines | 52 code | 21 blank | 12 comment | 0 complexity | 4d85af4f5a22c44c42370dce0b8261ba MD5 | raw file
Possible License(s): LGPL-3.0, GPL-2.0
1// Copyright (C) 2002-2010 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_TRIANGLE_RENDERER_TEXTURE_GOURAUD_H_INCLUDED__ 6#define __C_TRIANGLE_RENDERER_TEXTURE_GOURAUD_H_INCLUDED__ 7 8#include "IrrCompileConfig.h" 9 10#ifndef _IRR_COMPILE_WITH_SOFTWARE_ 11// forward declarations for create methods 12namespace irr 13{ 14namespace video 15{ 16 class ITriangleRenderer; 17 class IZBuffer; 18} // end namespace video 19} // end namespace irr 20 21#else 22 23#include "ITriangleRenderer.h" 24#include "IImage.h" 25 26namespace irr 27{ 28namespace video 29{ 30 //! CTRTextureGouraud class 31 class CTRTextureGouraud : public ITriangleRenderer 32 { 33 public: 34 35 //! constructor 36 CTRTextureGouraud(IZBuffer* zbuffer); 37 38 //! destructor 39 virtual ~CTRTextureGouraud(); 40 41 //! sets a render target 42 virtual void setRenderTarget(video::IImage* surface, const core::rect<s32>& viewPort); 43 44 //! draws an indexed triangle list 45 virtual void drawIndexedTriangleList(S2DVertex* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount); 46 47 //! en or disables the backface culling 48 virtual void setBackfaceCulling(bool enabled = true); 49 50 //! sets the Texture 51 virtual void setTexture(video::IImage* texture); 52 53 protected: 54 55 //! vertauscht zwei vertizen 56 inline void swapVertices(const S2DVertex** v1, const S2DVertex** v2) 57 { 58 const S2DVertex* b = *v1; 59 *v1 = *v2; 60 *v2 = b; 61 } 62 63 video::IImage* RenderTarget; 64 core::rect<s32> ViewPortRect; 65 66 IZBuffer* ZBuffer; 67 68 s32 SurfaceWidth; 69 s32 SurfaceHeight; 70 bool BackFaceCullingEnabled; 71 TZBufferType* lockedZBuffer; 72 u16* lockedSurface; 73 u16* lockedTexture; 74 s32 lockedTextureWidth; 75 s32 textureXMask, textureYMask; 76 video::IImage* Texture; 77 }; 78 79} // end namespace video 80} // end namespace irr 81 82#endif 83 84#endif 85