/*---------------------------------------------------------------------------* Project: Horizon File: demo_ShaderManager.h Copyright (C)2009-2012 Nintendo Co., Ltd. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Rev: 46365 $ *---------------------------------------------------------------------------*/ #ifndef DEMO_SHADER_MANAGER_H_ #define DEMO_SHADER_MANAGER_H_ #include #include #include "demo/ShaderProgram/demo_ProgramObject.h" #include "demo/ShaderProgram/demo_ColorFillProgram.h" #include "demo/ShaderProgram/demo_FontProgram.h" #include "demo/ShaderProgram/demo_DecalTextureProgram.h" namespace demo { /*! :private @brief Maximum shader binary count for ShaderManager class */ const u32 MAX_SHADER_BINARY_NUM = 1; /*! :private @brief Maximum shader count of a single shader binary for the ShaderManager class */ const u32 MAX_SHADER_PROGRAM_NUM = 3; /*! :private @brief Enumerate type indicating the basic shader */ enum ShaderType { COLOR_FILL_SHADER = 0, //!< vertex color shader FONT_SHADER = 1, //!< font shader DECAL_TEXTURE_SHADER = 2, //!< decal texture shader BASIC_SHADER_BINARY_SHADER_NUM = 3 //!< total number of basic shaders }; /*! :private @brief Shader binary index of basic shader */ const u32 BASIC_SHADER_BINARY_INDEX = 0; /*! :private @brief Class that manages shaders. */ class ShaderManager : private nn::util::NonCopyable { public: /*! :private @brief Constructor. */ ShaderManager(void); /*! :private @brief Destructor. */ virtual ~ShaderManager(void); public: /*! :private @brief Performs initial process. */ virtual bool Initialize(void); /*! :private @brief Performs shutdown. */ virtual bool Finalize(void); protected: virtual bool InitializeBasicShader(void); public: /*! :private @brief Gets vertex attributes of specified shader. @param[in] shaderType Shader type @return Vertex attributes */ u32 GetVertexAttributes(const ShaderType shaderType); /*! :private @brief Gets pointer to specified shader. @param[in] shaderType Shader type @return Shader program pointer */ ProgramObject* GetShaderProgram(const ShaderType shaderType); protected: bool m_Initialized; u8 m_Padding[3]; GLuint m_ShaderProgramIdArray[MAX_SHADER_BINARY_NUM][MAX_SHADER_PROGRAM_NUM]; ProgramObject* m_ShaderProgramPtrArray[MAX_SHADER_BINARY_NUM][MAX_SHADER_PROGRAM_NUM]; protected: ColorFillProgram m_ColorFillProgram; FontProgram m_FontProgram; DecalTextureProgram m_DecalTextureProgram; }; } #endif