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

📄 decal.h

📁 国外网游源码....除工具源码缺少之外,其余程序都全...至于,什么游戏,因为国内还没有,所以找不到测试
💻 H
字号:
// Decal.h: interface for the CDecal class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_DECAL_H__78B66DF1_4E11_4555_83FC_4C86D7F6FC3A__INCLUDED_)
#define AFX_DECAL_H__78B66DF1_4E11_4555_83FC_4C86D7F6FC3A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

const long maxDecalVertices = 256;
const float decalEpsilon = 0.25f;
const float epsilon = 0.001f;

static long GetNextActive(long x, long vertexCount,
	const bool *active)
{
	for (;;)
	{
		if (++x == vertexCount) x = 0;
		if (active[x]) return (x);
	}
}

static long GetPrevActive(long x, long vertexCount,
	const bool *active)
{
	for (;;)
	{
		if (--x == -1) x = vertexCount - 1;
		if (active[x]) return (x);
	}
}

struct Triangle		//	捞芭 乐绢具 且淀 窃.. 壬..
{
	WORD	index[3];
};

class CDecal  
{
public:
	CDecal();
//	CDecal( float width, float height, float depth, MCTEXTURE *	pTexture );
	CDecal( float width, float height, float depth );
	CDecal( D3DXVECTOR3& center, D3DXVECTOR3& normal, D3DXVECTOR3& tangent, float width, float height, float depth );
	virtual ~CDecal();

public:

	void		MakeDecalEx( D3DXVECTOR3& center, D3DXVECTOR3& normal, D3DXVECTOR3& tangent,				\
							DWORD dwFaceCount, MCFVFINDEX * pFace, MCOBJVERTEX * pVertex, D3DXMATRIX matWorld );

	void		MakeDecal( D3DXVECTOR3& center, D3DXVECTOR3& normal, D3DXVECTOR3& tangent, float width, float height, float depth );
	void		ClipMeshEx( DWORD dwFaceCount, MCFVFINDEX * pFace, MCOBJVERTEX * pVertex, D3DXMATRIX matWorld );
	void		MakeDecalTexCoord( float width, float height );

	void		AddDecalMesh( long vertexCount, D3DXVECTOR3 *vertex, D3DXVECTOR3& normal, Triangle *triangle );
	void		ClipDecal( long triangleCount, const Triangle *triangle, const D3DXVECTOR3 *vertex, const D3DXVECTOR3 *normal );
	void		RenderDecal();

private:
	bool		AddPolygon(long vertexCount, const D3DXVECTOR3 *vertex, const D3DXVECTOR3 *normal);
	void		ClipMesh(long triangleCount, const Triangle *triangle, const D3DXVECTOR3 *vertex, 
						const D3DXVECTOR3 *normal);

	long		ClipPolygon(long vertexCount, const D3DXVECTOR3 *vertex, const D3DXVECTOR3 *normal, 
						D3DXVECTOR3 *newVertex, D3DXVECTOR3 *newNormal) const;
	static long	ClipPolygonAgainstPlane(const D3DXPLANE& plane, long vertexCount, const D3DXVECTOR3 *vertex, 
						const D3DXVECTOR3 *normal, D3DXVECTOR3 *newVertex, D3DXVECTOR3 *newNormal);
	long		TriangulatePolygon(long vertexCount, const D3DXVECTOR3 *vertex, const D3DXVECTOR3& normal, 
						Triangle *triangle);

	
public:
	int				m_nDecalVertCount;
	int				m_nDecalTriCount;
	
	D3DXVECTOR3		p_vertexArray[maxDecalVertices];
	D3DXVECTOR3		vertexArray[maxDecalVertices];
	D3DXVECTOR3		normalArray[maxDecalVertices];
	D3DXVECTOR2		texcoordArray[maxDecalVertices];
	D3DXCOLOR		colorArray[maxDecalVertices];
	Triangle		triangleArray[maxDecalVertices];
	
protected:
	
private:
	D3DXVECTOR3		m_vDecalCenter;
	D3DXVECTOR3		m_vDecalNormal;
	D3DXVECTOR3		m_vTangent;
	D3DXVECTOR3		m_vBinormal;
	
	D3DXPLANE		m_Planeleft;
	D3DXPLANE		m_Planeright;
	D3DXPLANE		m_Planebottom;
	D3DXPLANE		m_Planetop;
	D3DXPLANE		m_Planefront;
	D3DXPLANE		m_Planeback;

	float			m_fWidth;
	float			m_fHeight;
	float			m_fDepth;
	
	
};

#endif // !defined(AFX_DECAL_H__78B66DF1_4E11_4555_83FC_4C86D7F6FC3A__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -