#ifndef ORSDK_DLL
#define ORSDK_DLL K_DLLEXPORT
#endif
#include "orshadertexmat_shader.h"
#define ORSHADERTEXMAT__CLASS ORSHADERTEXMAT__CLASSNAME
#define ORSHADERTEXMAT__DESC "OR - Shader TexMat Description"
ORSHADERTEXMAT__CLASS,
ORSHADERTEXMAT__DESCSTR,
ORSHADERTEXMAT__DESC,
bool ORShaderTexMat::FBCreate()
{
return true;
}
void ORShaderTexMat::FBDestroy()
{
}
void ORShaderTexMat::ShadeModel( FBRenderOptions* pRenderOptions, FBShaderModelInfo* pShaderModelInfo,
FBRenderingPass pPass )
{
FBModel* lModel = pShaderModelInfo->GetFBModel();
FBModelVertexData* lModelVertexData = lModel->ModelVertexData;
const int lSubRegionCount = lModelVertexData->GetSubRegionCount();
glEnable( GL_LIGHTING);
lModelVertexData->EnableOGLVertexData();
for(int lSubRegionIdx = 0; lSubRegionIdx < lSubRegionCount; ++lSubRegionIdx)
{
if (lModel->Materials.GetCount() > lSubRegionIdx)
{
FBMaterial* lMaterial = lModel->Materials[lSubRegionIdx];
lMaterial->OGLInit();
if (lDiffuseTex)
{
lDiffuseTex->OGLInit();
lModelVertexData->EnableOGLUVSet(lDiffuseTex->Mapping);
glEnable( GL_TEXTURE_2D );
}
lModelVertexData->DrawSubRegion(lSubRegionIdx);
if (lDiffuseTex)
{
lModelVertexData->DisableOGLUVSet();
glDisable(GL_TEXTURE_2D);
}
}
else
{
lModelVertexData->DrawSubRegion(lSubRegionIdx);
}
}
lModelVertexData->DisableOGLVertexData();
glDisable(GL_LIGHTING);
}