d3dshader.h
来自「使用shader语言在vs阶段编写光照效果的演示程序及全部源代码」· C头文件 代码 · 共 61 行
H
61 行
#ifndef __D3DSHADER_H__
#define __D3DSHADER_H__
#include "D3DBase.h"
class IShader
{
protected:
LPD3DXCONSTANTTABLE m_pConstTable;
IDirect3DDevice9* m_pD3DDevice;
public:
virtual bool load(const char* strShader,const char* main = "main") = 0;
virtual void bind() = 0 ;
virtual void unbind() = 0 ;
virtual void unload() = 0 ;
void set_float (const char* Name , float v );
void set_float_array (const char* Name , float* v ,int Count);
void set_int (const char* Name , int v );
void set_int_array (const char* Name , int* v ,int Count);
void set_vector(const char* Name , D3DXVECTOR4* vec);
void set_matrix(const char* Name , D3DXMATRIX* mat);
void set_matrix_t(const char* Name , D3DXMATRIX* mat);
};
class CPixelShader : public IShader
{
IDirect3DPixelShader9* m_pPixelShader;
public:
static bool bValidPS(DWORD PSversion);
CPixelShader();
bool load(const char* pixelShader,const char* main = "main");
void bind();
void unbind();
void unload();
bool isSurpport(){return m_pPixelShader!= NULL;};
};
class CVertexShader : public IShader
{
IDirect3DVertexShader9* m_pVertexShader;
public:
static bool bValidVS(DWORD VSversion);
CVertexShader();
bool load(const char* vertexShader,const char* main = "main");
void bind();
void unbind();
void unload();
bool isSurpport(){return m_pVertexShader!= NULL;};
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?