📄 puck.h
字号:
#ifndef __PUCK_H
#define __PUCK_H
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glaux.h>
#include "object.h"
#include "vector.h"
#include "table.h"
// data points for puck
static float puckData[32][3] =
// bottom points
{ { 0.0, 0.01, 1.0 }, { 0.3827, 0.01, 0.9239 },
{ 0.7071, 0.01, 0.7071 }, { 0.9239, 0.01, 0.3827 }, { 1.0, 0.01, 0.0 },
{ 0.9239, 0.01, -0.3827 }, { 0.7071, 0.01, -0.7071 }, { 0.3827, 0.01, -0.9239 },
{ 0.0, 0.01, -1.0 }, { -0.3827, 0.01, -0.9239 }, { -0.7071, 0.01, -0.7071 },
{ -0.9239, 0.01, -0.3827 }, { -1.0, 0.01, 0.0 }, { -0.9237, 0.01, 0.3827 },
{ -0.7071, 0.01, 0.7071 }, { -0.3827, 0.01, 0.9239 },
// top points
{ 0.0, 0.07, 1.0 }, { 0.3827, 0.07, 0.9239 },
{ 0.7071, 0.07, 0.7071 }, { 0.9239, 0.07, 0.3827 }, { 1.0, 0.07, 0.0 },
{ 0.9239, 0.07, -0.3827 }, { 0.7071, 0.07, -0.7071 }, { 0.3827, 0.07, -0.9239 },
{ 0.0, 0.07, -1.0 }, { -0.3827, 0.07, -0.9239 }, { -0.7071, 0.07, -0.7071 },
{ -0.9239, 0.07, -0.3827 }, { -1.0, 0.07, 0.0 }, { -0.9237, 0.07, 0.3827 },
{ -0.7071, 0.07, 0.7071 }, { -0.3827, 0.07, 0.9239 } };
class CPuck : public CObject
{
private:
float radius; // puck radius
public:
CPuck()
{
acceleration = CVector(0.0, 0.0, 0.0);
velocity = CVector(50.0, 0.0, 100.0);
position = CVector(150.0, 0.0, -200.0);
radius = 10.0; size = radius;
}
CPuck(float r)
{
radius = r; size = r;
acceleration = CVector(0.0, 0.0, 0.0);
velocity = CVector(50.0, 0.0, 100.0);
position = CVector(150.0, 0.5, -200.0);
}
~CPuck() {}
void Load();
void Unload();
void Draw();
void Animate(scalar_t deltaTime);
void Animate(scalar_t deltaTime, CTable *table);
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -