99 lines
2.5 KiB
C++
99 lines
2.5 KiB
C++
#pragma once
|
|
|
|
/***********************************************************************************/
|
|
/** \file Shader.h
|
|
** \brief Header File zur Klasse Shader
|
|
*************************************************************************************
|
|
** Autor: Christian Roesch
|
|
*************************************************************************************
|
|
** _tut nichts_
|
|
**
|
|
*//*********************************************************************************/
|
|
|
|
#ifndef _Shader_H
|
|
#define _Shader_H
|
|
|
|
// includes
|
|
#include <d3dx9.h>
|
|
|
|
#include <cassert>
|
|
|
|
#ifdef EXTRACODE
|
|
#include <string>
|
|
#endif
|
|
|
|
// Klassen-Deklaration
|
|
extern IDirect3DDevice9 *g_d3d_device;
|
|
|
|
/***********************************************************************************/
|
|
/** \brief Shader _tut nichts_
|
|
*************************************************************************************
|
|
** Genau genommen _tut dies nichts_
|
|
**
|
|
*//*********************************************************************************/
|
|
|
|
class Shader
|
|
{
|
|
public:
|
|
void Init();
|
|
|
|
void DeInit();
|
|
|
|
void Release();
|
|
|
|
void CompileVS(const char* pShaderCode, const char* pEntryPoint, IDirect3DVertexShader9 **ppCachedShader = NULL );
|
|
void CompilePS(const char* pShaderCode, const char* pEntryPoint );
|
|
|
|
void SetTextureStageSettings(
|
|
int iTextureStage,
|
|
int iTextureIndex= -1,
|
|
int iTextureSettings= -1 );
|
|
|
|
void Activate();
|
|
|
|
static void Deactivate();
|
|
|
|
static void SetConstants(bool bHDR = false);
|
|
static void SetResolution(int iResX, int iResY);
|
|
static void SetCamera(const D3DXMATRIX &mView, const D3DXMATRIX &mProj,
|
|
const D3DXVECTOR3 &vCamPos, const D3DXVECTOR3 &vCamDir, D3DXMATRIX *pMatVP = NULL);
|
|
static void SetTransform(const D3DXMATRIX &mWorld, const D3DXMATRIX &mWorldInverse);
|
|
|
|
#ifdef EXTRACODE
|
|
inline int GetRevision() const { return m_iRevision; };
|
|
#endif
|
|
|
|
private:
|
|
void Compile(
|
|
const char* pShaderCode,
|
|
const char* pEntryPoint,
|
|
const char* ShaderModel,
|
|
ID3DXBuffer** tmp );
|
|
|
|
IDirect3DVertexShader9* m_pVSShader;
|
|
IDirect3DPixelShader9* m_pPSShader;
|
|
|
|
static const int m_iMaxTextureStageCount= 5;
|
|
int m_iUsedTextureStageCount;
|
|
int m_iTextureIndices[ m_iMaxTextureStageCount ];
|
|
int m_iTextureSettings[ m_iMaxTextureStageCount ];
|
|
|
|
#ifdef EXTRACODE
|
|
std::string m_strPSCode;
|
|
std::string m_strVSCode;
|
|
int m_iRevision;
|
|
#endif
|
|
|
|
static D3DXMATRIX s_matVP;
|
|
|
|
};
|
|
|
|
#endif//_Shader_H
|
|
|
|
class Shader;
|
|
|
|
|
|
/************************************************************************************
|
|
** Ende der Datei: Shader.h
|
|
************************************************************************************/
|