📄 scene.cpp
字号:
/*==============================================================================
Header Files and Global Defines
==============================================================================*/
#include "resource.h" //Header File for Resource IDs and Headers
/*==============================================================================
Global Variables
==============================================================================*/
//~~~~~System Variables
extern float speed_mod;
struct option
{
unsigned int particle_count;
int particle_speed;
int top_x;
int top_y;
int bottom_x;
int bottom_y;
int fade;
int point;
int red;
int green;
int blue;
};
extern struct option options;
/*==============================================================================
FUNCTION PROTOTYPES
==============================================================================*/
//=====Scene Drawing
int DrawScene();
//=====Drawing Functions
void xia_Grid(float VerticleMax, float VerticleMin, float HorizontalMax,
float HorizontalMin, float space, float max, float z);
//=====External Functions
//Particle Generator Function
extern void xia_GenFire(float limit_x1, float limit_x2, float max_y, float min_y, float z, float speed_fade,
float speed_point, float r, float g, float b, float a, float speed_mod);
/*==============================================================================
OPENGL RENDERING SCENE
==============================================================================*/
int DrawScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//glEnable(GL_BLEND);
glDepthMask(GL_FALSE);
glEnable(GL_TEXTURE_2D);
//=======Particle Generator
glPushMatrix();
xia_GenFire(options.top_x*.1, options.bottom_x*.1, options.top_y*.1, options.bottom_y*.1, -22.0,speed_mod*options.fade*.0001,
speed_mod*options.point*.0001, options.red*.01, options.green*.01, options.blue*.01, 1.0, speed_mod*options.particle_speed*.001);
glPopMatrix();
glDepthMask(GL_TRUE);
//=======Grid Background
glDisable(GL_TEXTURE_2D);
glPushMatrix();
glColor3f(0.0,0.25,0.0);
glTranslatef(0.0,0.0,-2.0);
xia_Grid(2.6, 2.6, 2.6, 2.6, .18, 2.6, -2.0);
glPopMatrix();
//glDisable(GL_BLEND);
return TRUE;
}
/*==============================================================================
FUNCTIONS
==============================================================================*/
void xia_Grid(float VerticleMax, float VerticleMin, float HorizontalMax,
float HorizontalMin, float space, float max, float z)
{
for(float loop=0.0; loop <= max; loop+=space)
{
//Horizontal
glBegin(GL_LINES);
glVertex3f(-HorizontalMin,loop,z);
glVertex3f(HorizontalMax,loop,z);
glEnd();
glBegin(GL_LINES);
glVertex3f(HorizontalMin,-loop,z);
glVertex3f(-HorizontalMax,-loop,z);
glEnd();
//Verticle
glBegin(GL_LINES);
glVertex3f(loop,-VerticleMax,z);
glVertex3f(loop,VerticleMin,z);
glEnd();
glBegin(GL_LINES);
glVertex3f(-loop,VerticleMax,z);
glVertex3f(-loop,-VerticleMin,z);
glEnd();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -