source file REDRenderShaderPhong.h

Go to the documentation of this file.

#ifndef RED_RENDER_SHADER_PHONG_H
#define RED_RENDER_SHADER_PHONG_H

//************************************************************************************************************
// Copyright (c) 2005 Redway3D. All rights reserved. Redway3D is a registered trademark. Any reproduction and /
// or utilization of any material from this document without Redway3D?s express authorization are prohibited.
//************************************************************************************************************

#include "REDRenderShader.h"
#include "REDState.h"
#include "REDIMaterial.h"


//******************************************************************************
//*** Program parameters & defines *********************************************
//******************************************************************************

#define RED_RSH_PHONG_RENDER_PASS            "red_rsh_phong_render_pass"
#define RED_RSH_PHONG_DIFFUSE_COLOR          "red_rsh_phong_diffuse_color"
#define RED_RSH_PHONG_DIFFUSE_TEXTURE        "red_rsh_phong_diffuse_texture"
#define RED_RSH_PHONG_DIFFUSE_MATRIX         "red_rsh_phong_diffuse_matrix"
#define RED_RSH_PHONG_DIFFUSE_UV             "red_rsh_phong_diffuse_uv"
#define RED_RSH_PHONG_SPECULAR_COLOR         "red_rsh_phong_specular_color"
#define RED_RSH_PHONG_SPECULAR_TEXTURE       "red_rsh_phong_specular_texture"
#define RED_RSH_PHONG_SPECULAR_MATRIX        "red_rsh_phong_specular_matrix"
#define RED_RSH_PHONG_SPECULAR_UV            "red_rsh_phong_specular_uv"
#define RED_RSH_PHONG_EXPONENT_VALUE         "red_rsh_phong_exponent_value"
#define RED_RSH_PHONG_EXPONENT_TEXTURE       "red_rsh_phong_exponent_texture"
#define RED_RSH_PHONG_EXPONENT_MATRIX        "red_rsh_phong_exponent_matrix"
#define RED_RSH_PHONG_EXPONENT_UV            "red_rsh_phong_exponent_uv"
#define RED_RSH_PHONG_EXPONENT_RANGE         "red_rsh_phong_exponent_range"
#define RED_RSH_PHONG_TRANSPAR_COLOR         "red_rsh_phong_transpar_color"
#define RED_RSH_PHONG_TRANSPAR_TEXTURE       "red_rsh_phong_transpar_texture"
#define RED_RSH_PHONG_TRANSPAR_MATRIX        "red_rsh_phong_transpar_matrix"
#define RED_RSH_PHONG_TRANSPAR_UV            "red_rsh_phong_transpar_uv"
#define RED_RSH_PHONG_NORMAL_MAP_TEXTURE     "red_rsh_phong_normal_map_texture"
#define RED_RSH_PHONG_NORMAL_MAP_MATRIX      "red_rsh_phong_normal_map_matrix"
#define RED_RSH_PHONG_NORMAL_MAP_UV          "red_rsh_phong_normal_map_uv"
#define RED_RSH_PHONG_TANGENT_CHANNEL        "red_rsh_phong_tangent_channel"
#define RED_RSH_PHONG_SOFTEN                 "red_rsh_phong_soften"
#define RED_RSH_PHONG_BLINN                  "red_rsh_phong_blinn"


//******************************************************************************
//*** Shader naming ************************************************************
//******************************************************************************

#define RED_PHONG_SHADER_LIT_STRING_ID              "Phong_LIT"
#define RED_PHONG_SHADER_INDIRECT_LIT_STRING_ID     "Phong_INDIRECT_LIT"


//******************************************************************************
//*** RenderShaderPhong class **************************************************
//******************************************************************************

namespace RED
{
  class REDFullExp RenderShaderPhong : public RED::RenderShader
  {
    public:
      
      // Typing information:
      // -------------------
      
      SET_CID( CID_class_REDRenderShaderPhong ) IMPLEMENT_AS();
      
      
      // Construction and destruction method:
      // ------------------------------------
      
      RenderShaderPhong( RED::MATERIAL_PASS iRenderPass,
                         
                         const RED::Color&  iDiffuseColor,
                         const RED::Object* iDiffuseTexture,
                         const RED::Matrix& iDiffuseMatrix,
                         RED::MESH_CHANNEL  iDiffuseUV,
                         
                         const RED::Color&  iSpecularColor,
                         const RED::Object* iSpecularTexture,
                         const RED::Matrix& iSpecularMatrix,
                         RED::MESH_CHANNEL  iSpecularUV,
                         
                         float              iSpecExp,
                         const RED::Object* iSpecExpTexture,
                         const RED::Matrix& iSpecExpMatrix,
                         RED::MESH_CHANNEL  iSpecExpUV,
                         float              iSpecExpRange,
                         
                         const RED::Color&  iTransparColor,
                         const RED::Object* iTransparTexture,
                         const RED::Matrix& iTransparMatrix,
                         RED::MESH_CHANNEL  iTransparUV,
                         
                         const RED::Object* iNormalMap,
                         const RED::Matrix& iNormalMatrix,
                         RED::MESH_CHANNEL  iNormalUV,
                         RED::MESH_CHANNEL  iTangentChannel,
                         
                         float              iSoften,
                         bool               iUseBlinnEquation,
                         
                         RED::Object*       iResMgr,
                         RED_RC&            oErrorCode );
      
      
      virtual ~RenderShaderPhong ();
      
      
      // Programs management:
      // --------------------
      
      static RED_RC LoadProgram( RED::String&                oString,
                                 const RED::ShaderProgramID& iID );
      
      
      static RED_RC EvaluateFromInputParameters( RED::RenderShader* ioShader,
                                                 RED::Object*       iResMgr );
  };
};


#endif