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

📄 glparticle.h

📁 实战粒子系统例程
💻 H
字号:
/*
	glparticle.h - Particle system
	Copyright (c) HalfLucifer, 2002.3.1
*/
#ifndef __GLPARTICLEH__
#define __GLPARTICLEH__

#include <windows.h>
#include <math.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include "glcamera.h"
#include "gltexture.h"
#include "glvector.h"

extern GLcamera camera;
extern bool g_billboard;

struct Particle
{
	GLvector position;
	GLvector velocity;
	float energy;
};

class GLparticle
{

public:
	GLparticle();
	~GLparticle();
	bool Initialize();
	void Update();
	void Render();
	void SetEmitterPos(GLvector &pos);
	void MoveEmitterPos(GLvector &pos);
	void SetColor(GLvector &color);

	int GetNum() { return m_NumParticle; }
	float GetSize() { return m_Size; }
	float GetGravity() { return m_Gravity; }
	float GetBounce() { return m_Bounce; }
	float GetEnergyDrop() { return m_EnergyDrop; }
	float GetBirthVelocity() { return m_BirthVelocity; }

	void SetNum(int num);
	void SetSize(float size) { if (size>0) m_Size = size; }
	void SetGravity(float gr) { if (gr>0) m_Gravity = gr; }
	void SetBounce(float bo) { if (bo>0) m_Bounce = bo; }
	void SetEnergyDrop(float ed) { if (ed>0) m_EnergyDrop = ed; }
	void SetBirthVelocity(float bv) { if (bv>0) m_BirthVelocity = bv; }

protected:
	int m_NumParticle;
	float m_Size;
	float m_Radius;
	float m_Gravity;
	float m_Bounce;
	float m_EnergyDrop;
	float m_BirthVelocity;

	GLtexture m_Texture;
	GLvector m_Color;
	GLvector m_Position;
	GLvector m_Target;
	Particle *m_ParticlePool;

};

#endif

⌨️ 快捷键说明

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