⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d3dshader.h

📁 使用shader语言在vs阶段编写光照效果的演示程序及全部源代码
💻 H
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -