- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

# ImmediateModeRenderer/ImmediateModeRenderer.h

    //**************************************************************************/
    // Copyright (c) 2008 Autodesk, Inc.
    // All rights reserved.
    //
    // Use of this software is subject to the terms of the Autodesk license
    // agreement provided at the time of installation or download, or which
    // otherwise accompanies this software in either electronic or hard copy form.
    //
    //**************************************************************************/
    // DESCRIPTION:
    // CREATED: April 2010
    //**************************************************************************/

    #if defined(JAMBUILD)
    #include <Mudbox/mudbox.h>
    #include <Mudbox/MudBoxGL.h>
    #else
    #include "../../include/Mudbox/mudbox.h"
    #include "../../include/Mudbox/MudBoxGL.h"
    #endif

    using namespace mudbox;

    class ImmediateModeRenderer : public MeshRenderer
    {
        DECLARE_CLASS;

    public:

        ImmediateModeRenderer( void );
        ~ImmediateModeRenderer( void );

        // Overrides for Node class
        virtual void OnNodeEvent( const Attribute &, NodeEventType );
        virtual void Serialize( Stream & );

        // Overrides for MeshRenderer class

        virtual void Initialize( void );
        virtual void SetMesh( Mesh *pMesh );
        virtual void Render(
            const Selector *pSelector = 0,
            bool bSkipMaterials = false,
            const Camera *pCamera = 0,
            const AxisAlignedBoundingBox &bUVFilter = AxisAlignedBoundingBox()
            );

        virtual unsigned int RenderData( const Selector *pSelector, unsigned int iStart, const Camera *pCamera );
        virtual void DecodeData( unsigned int iData, unsigned int &iFaceIndex, unsigned int &iVertexIndex );

        virtual void OnVertexPositionChange( unsigned int iVertexIndex, unsigned int iFaceIndex );
        virtual void OnVertexStateChange( unsigned int iVertexIndex, unsigned int iFaceIndex );
        virtual void OnMeshChange( void );

        virtual void SetLODLevel( float fLevel );
        virtual float LODLevel( void ) const;

        virtual const AxisAlignedBoundingBox &ActiveUVArea( void ) const;

        virtual void SetWireFrameMode( bool bMode );
        virtual bool WireFrameMode( void ) const;
        virtual void SetColorMode( bool bMode );
        virtual bool ColorMode( void ) const;
        virtual void SetWireLevel( unsigned int iLevel );
        virtual unsigned int WireLevel( void ) const;
        virtual void SetTextureCoordinateMode( bool bMode );
        virtual bool TextureCoordinateMode( void ) const;
        virtual void SetTangentMode( bool bMode );
        virtual bool TangentMode( void ) const;

        virtual bool ReadyForClientRender() { return true;}

        virtual void SetFacetedMode( bool bMode );
        virtual bool FacetedMode( void ) const;

    private:

        void renderTriangle(unsigned int index);
        void renderTriangleNormals();
        void renderQuad(unsigned int index);
        void renderQuadNormals();

        Mesh *m_pMesh;

        float m_fPointSize;
        float m_fLineWidth;

        GLenum m_ePolygonMode;

        bool m_bTCMode;
        bool m_bFacetedMode;

        AxisAlignedBoundingBox m_ActiveUVArea;

        // Get color depth of render target
        GLint m_iRedBits, m_iGreenBits, m_iBlueBits;
    };